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.0207232050230.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>)
Responses Re: Queries not using Index  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-sql
Hi,

>You _have_ actually run ANALYZE on the table, right?

snet=# vacuum analyze t2002_06;
VACUUM
snet=# vacuum analyze;
VACUUM
snet=# explain analyze select * from t2002_06 WHERE station = 'SAMI4';
NOTICE:  QUERY PLAN:

Seq Scan on t2002_06  (cost=0.00..35379.69 rows=35169 width=47) (actual 
time=20.51..1717.78 rows=38146 loops=1)
Total runtime: 1730.63 msec

EXPLAIN
snet=# set enable_seqscan=off;
SET VARIABLE
snet=# explain analyze select * from t2002_06 WHERE station = 'SAMI4';
NOTICE:  QUERY PLAN:

Index Scan using t2002_06_station_idx on t2002_06  (cost=0.00..132773.85 
rows=35169 width=47) (actual time=74.86..299.53 rows=38146 loops=1)
Total runtime: 313.42 msec

EXPLAIN

Any thoughts?  I am sorry to be causing all this trouble.  I just want my 
queries to voom-voom!!  Interestingly enough, I see that the SEQ SCAN is 
now estimated at 1730.63, when I first posted to this list, it was 3900.00 
or so. Errrr

Thanks, Daryl




pgsql-sql by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Queries not using Index
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Queries not using Index