Re: Queries not using Index

From: Daryl Herzmann <akrherz(at)iastate(dot)edu>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Queries not using Index
Date: 2002-07-24 02:24:01
Message-ID: Pine.LNX.4.44.0207232114500.1226-100000@12-216-9-13.client.mchsi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 USING btree (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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-07-24 07:24:07 Re: pg_dump and sequences
Previous Message Christopher Kings-Lynne 2002-07-24 02:09:17 Re: Queries not using Index