From: | Reece Hart <reece(at)harts(dot)net> |
---|---|
To: | Tyler Durden <tylersticky(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Seq Scan |
Date: | 2007-06-01 17:50:46 |
Message-ID: | 1180720246.4821.47.camel@snafu.site |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 2007-06-01 at 18:24 +0100, Tyler Durden wrote:
> It uses Index Scan for id>200000 and Seq Scan for id>10?!
Based on the statistics pg has for your table, and on the cost of using
the index, the cost based optimizer decided that it's more efficient to
seq scan all of the rows than to incur the index overhead. These
decisions are not always correct, but they're usually quite good.
If you don't believe it, try:
# set enable_seqscan=off;
# explain analyze ...
# set enable_seqscan=on;
# explain analyze ...
-Reece
--
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Ginsburg | 2007-06-01 18:00:10 | Re: Interval Rounding |
Previous Message | Michael Glaesemann | 2007-06-01 17:46:00 | Re: Seq Scan |