Re: EXPLAIN ANALYZE not considering primary and unique indices! - Mailing list pgsql-general

From Alan Hodgson
Subject Re: EXPLAIN ANALYZE not considering primary and unique indices!
Date
Msg-id 200708271144.18213@hal.medialogik.com
Whole thread Raw
In response to EXPLAIN ANALYZE not considering primary and unique indices!  (Sanjay <skpatel20@gmail.com>)
List pgsql-general
On Monday 27 August 2007 05:21, Sanjay <skpatel20@gmail.com> wrote:
>Wondering why it is not using the index, which would have
> been
> automatically created for the primary key.

Because you not only have just one row in the whole table, 100% of them will
match the query. In short, one page fetch for a seq scan is faster than
first looking it up in an index and then fetching the same page.

set enable_seqscan=false;


--
"Government big enough to supply everything you need is big enough to take
everything you have ... the course of history shows that as a government
grows, liberty decreases." -- Thomas Jefferson


pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: EXPLAIN ANALYZE not considering primary and unique indices!
Next
From: Decibel!
Date:
Subject: Re: [HACKERS] Undetected corruption of table files