Queries not using Index

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

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 Daryl Herzmann 2002-07-22 19:07:26 Queries not using Index
Previous Message Gaetano Mendola 2002-07-22 17:37:45 Re: interval syntax change from 7.1.2 to 7.2.1?