From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
Cc: | "Bruce Momjian" <bruce(at)momjian(dot)us>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: COUNT(*) and index-only scans |
Date: | 2011-10-10 18:43:07 |
Message-ID: | 5617.1318272187@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>> I talked to Robert Haas and he said that index-only scans do not
>> optimize COUNT(*). Is this something we can do for PG 9.2? Is
>> anyone working on this?
> Well, it's not that it doesn't optimize COUNT(*) -- it's that it
> doesn't yet cost the index scan as cheaper than a table scan when
> you're accessing every row.
I think what Robert is complaining about is that we won't currently
consider an index that matches neither any WHERE clauses nor ORDER BY,
ie, count(*) over the whole table won't get considered for an index-only
scan, regardless of cost estimates.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-10-10 18:52:23 | Re: ALTER EXTENSION .. ADD/DROP weirdness |
Previous Message | Tom Lane | 2011-10-10 18:38:09 | Re: SET variable - Permission issues |