From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Matt Smiley" <mss(at)rentrak(dot)com> |
Cc: | david(dot)west(at)cusppoint(dot)com, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: limit clause breaks query planner? |
Date: | 2008-09-02 21:00:48 |
Message-ID: | 5925.1220389248@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
"Matt Smiley" <mss(at)rentrak(dot)com> writes:
> So an Index Scan is always going to have a higher cost estimate than
> an equivalent Seq Scan returning the same result rows (unless
> random_page_cost is < 1). That's why I think the planner is always
> preferring the plan that uses a Seq Scan.
If that were the case, we'd never choose an indexscan at all...
It's true that a plain indexscan is not preferred for queries that will
return a large fraction of the table. However, it should be willing to
use a bitmap scan for this query, given default cost settings (the
default cost settings will cause it to prefer bitmap scan for retrieving
up to about a third of the table, in my experience). I too am confused
about why it doesn't prefer that choice in the OP's example. It would
be interesting to alter the random_page_cost setting and see if he gets
different results.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | behrangs | 2008-09-03 04:20:04 | Re: Samsung 32GB SATA SSD tested |
Previous Message | Matt Smiley | 2008-09-02 19:38:19 | Re: limit clause breaks query planner? |