Hi All,
I have a query that does not use index scan and hence takes long time to execute.
It is a simple query:
SELECT value FROM test WHERE name='blah_blah';
and the "test" table has the following structure
Column | Type | Modifiers
name | character varying(50) | not null
value | text |
Indexes: test_pkey primary key btree (name)
The explain analyze output for the query is:
explain SELECT value FROM test WHERE name='blah_blah';
QUERY PLAN
--------------------------------------------------------------
Seq Scan on test (cost=0.00..1.82 rows=1 width=7)
Filter: (name = 'blah_blah'::character varying)
(2 rows)
Since name is a primary key, shouldn't the query use index scan on it??
However, if I force Postgres to use index scan by setting enable_seqscan to off, the query uses index scan on name.
Can someone tell how I can make the query to use index scan on name without having to force postgres?
Thanks in advance,
Saranya
Do you Yahoo!?
Meet the
all-new My Yahoo! � Try it today!