Index scan problem

Поиск
Список
Период
Сортировка
От sarlav kumar
Тема Index scan problem
Дата
Msg-id 20041116223835.15589.qmail@web51308.mail.yahoo.com
обсуждение исходный текст
Список pgsql-novice
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!

В списке pgsql-novice по дате отправления:

Предыдущее
От: Fernando Fernández
Дата:
Сообщение: Fw: Re: [webmaster] Question
Следующее
От: Claire McGovern
Дата:
Сообщение: Trigger output to file.