From: John Oakes <john@networkproductions.net>
To: pgsql-sql@postgresql.org
Subject: Index doesn't appear to be working.
Date: Sat, 2 Mar 2002 19:28:23 -0500
Message-ID: <001801c1c24a$56369270$cb842341@john> (raw)
I have a table with a column titled 'passfail' that only contains either a P
for pass or an F for fail. The table name is 'one'. I created the index on
the table with:
CREATE INDEX one_passfail_idx ON one USING btree (passfail);
I then do:
VACUUM ANALYZE one;
Then I do an explain on this query:
SELECT * FROM one where passfail = 'P';
and it tells me:
Seq Scan on one (cost=0.00..263.02 rows=5613 width=56)
Shouldn't it tell me
Index Scan using one_passfail_idx on one?
Why isn't it using the index? This query returns about 5,600 of 10,000
records. It is faster to just do a seq scan because it returns such a high
percentage or records? Thanks, I appreciate the help!
John Oakes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: john@networkproductions.net
Subject: Re: Index doesn't appear to be working.
In-Reply-To: <001801c1c24a$56369270$cb842341@john>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox