Re: COUNT(*) and index-only scans - Mailing list pgsql-hackers

From Tom Lane
Subject Re: COUNT(*) and index-only scans
Date
Msg-id 8465.1318277872@sss.pgh.pa.us
Whole thread Raw
In response to Re: COUNT(*) and index-only scans  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: COUNT(*) and index-only scans  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.
> I guess the trick would be to get it to consider such plans only
> under some conditions, to avoid explosive growth in planning time
> for some types of queries.  Some statistics bucket for the number of
> non-frozen tuples in the relation, maybe?

My intention was to allow it to consider any covering index.  You're
thinking about the cost estimate, which is really entirely different.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Overhead cost of Serializable Snapshot Isolation
Next
From: Kohei KaiGai
Date:
Subject: Re: [v9.2] Fix Leaky View Problem