Re: Queries not using Index - Mailing list pgsql-sql

From Daryl Herzmann
Subject Re: Queries not using Index
Date
Msg-id Pine.LNX.4.44.0207232114500.1226-100000@12-216-9-13.client.mchsi.com
Whole thread Raw
In response to Re: Queries not using Index  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-sql
Hi! :)

On Wed, 24 Jul 2002, Christopher Kings-Lynne wrote:

>Have you tried playing with the statistics gatherer?

Nope.  I will look at the docs some and play around.  This machine is not 
fully production yet. :)

>Also, what is the result of:
>select indexdef from pg_indexes where indexname='t2002_06_station_idx';

snet=# select indexdef from pg_indexes where 
indexname='t2002_06_station_idx';                             indexdef                               
---------------------------------------------------------------------CREATE INDEX t2002_06_station_idx ON t2002_06
USINGbtree (station)
 


>It's no trouble.  Cases where the planner fails are essential to improving
>the planner.  Ideally this query should use your index automatically...

Thanks!  I have the ~exact~ same database on another machine with PG 7.1.2 
and it uses the Index Scan without tweaking.  I have never had troubles 
with indexes up until this table/database.

I have got another database on the same 7.2.1 machine.  It has very 
similar data and the same index.  It has no trouble defaulting to use the 
Index.

awos=# explain analyze select * from t1999_06 WHERE station = 'SAMI4';
NOTICE:  QUERY PLAN:

Index Scan using t1999_06_stn_idx on t1999_06  (cost=0.00..25859.88 
rows=36544 width=53) (actual time=152.94..152.94 rows=0 loops=1)
Total runtime: 153.03 msec

EXPLAIN

Augh.  Puzzling.  Thanks everyone for the help!  You all rock!

Daryl




pgsql-sql by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Queries not using Index
Next
From: Tom Lane
Date:
Subject: Re: pg_dump and sequences