Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Query not using index pgsql 8.2.3


  • From: Michael Fuhr <mike(at)fuhr(dot)org>
  • To: Henrik Zagerholm <henke(at)mac(dot)se>
  • Cc: pgsql-general(at)postgresql(dot)org
  • Subject: Re: Query not using index pgsql 8.2.3
  • Date: Fri, 23 Mar 2007 05:33:45 -0600
  • Message-id: <20070323113345(dot)GA76184(at)winnie(dot)fuhr(dot)org>

On Fri, Mar 23, 2007 at 11:43:54AM +0100, Henrik Zagerholm wrote:
> I'm having a hard time understanding why my query is not using my  
> indices when I change a field in the WHERE clause.

The row count estimate for fk_filetype_id = 83 is high by an order
of magnitude:

> Bitmap Index Scan on tbl_file_idx6  (cost=0.00..25.65 rows=1251  
> width=0) (actual time=21.958..21.958 rows=112 loops=1)
>                                                                      
> Index Cond: (fk_filetype_id = 83)

Have you run ANALYZE or VACUUM ANALYZE on these tables recently?
If so then you might try increasing the statistics target for
tbl_file.fk_filetype_id and perhaps some of the columns in the join
conditions.

-- 
Michael Fuhr



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group