Queries not using Index

From: Daryl Herzmann <akrherz(at)iitap(dot)iastate(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Queries not using Index
Date: 2002-07-22 19:07:26
Message-ID: Pine.LNX.4.44.0207221505070.6373-100000@pass.physics.iastate.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

(sorry if you get this twice, my first post bounced since I did not use
the subscribed email account. I assume that those messages get
discarded...)

Greetings,

I suppose I should have sent this to pgsql-bugs maybe? I would appreciate
it if anybody could help me out. I can't figure out what is going on
here...

snet=# select version();
version
-------------------------------------------------------------
PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96

snet=# \d t2002_06
Table "t2002_06"
Column | Type | Modifiers
---------+--------------------------+-----------
station | character varying(5) |
valid | timestamp with time zone |
tmpf | smallint |
dwpf | smallint |
drct | smallint |
sknt | real |
pday | real |
pmonth | real |
srad | real |
relh | real |
alti | real |
Indexes: t2002_06_station_idx,
t2002_06_tmpf_idx

snet=# \d t2002_06_station_idx;
Index "t2002_06_station_idx"
Column | Type
---------+----------------------
station | character varying(5)

snet=# select count(valid) from t2002_06;
count
---------
1513895

snet=# vacuum analyze t2002_06;
VACUUM

snet=# vacuum t2002_06;
VACUUM

snet=# explain SELECT * from t2002_06 WHERE station = 'SGLI4';
NOTICE: QUERY PLAN:

Seq Scan on t2002_06 (cost=0.00..35379.69 rows=35564 width=47)

EXPLAIN

Shouldn't this be an index scan? I hope that I am not doing something
stupid, although I probably am :(

I even just tried this

drop index t2002_06_station_idx;
vacuum analyze t2002_06;
create index t2002_06_station_idx on t2002_06(station);
vacuum analyze t2002_06;

And I still get a Seq Scan. Augh....

Thanks,
Daryl

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message James Orr 2002-07-22 20:09:21 Re: Editor for pgsql
Previous Message Daryl Herzmann 2002-07-22 18:59:31 Queries not using Index