Re: Query planner refuses to use index - Mailing list pgsql-general

From Tom Lane
Subject Re: Query planner refuses to use index
Date
Msg-id 29291.1122041820@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query planner refuses to use index  (Kilian Hagemann <hagemann1@egs.uct.ac.za>)
Responses Re: Query planner refuses to use index
List pgsql-general
Kilian Hagemann <hagemann1@egs.uct.ac.za> writes:
>> - what version are you running?

> 7.4.8, not sure if I'm ready for 8 yet.

Pre-8.0 tends to underestimate the correlation of a multicolumn index.
(8.0 may too, but not as much.)

> Also, note that set_id is strictly increasing (hence correlation of 1) and
> rec_time is strictly increasing within records with same set_id.

So the reason the indexscan is so good is that the ordering correlation
is perfect.  This isn't the planner's default assumption, and
unfortunately we haven't got statistics available that would allow
correlation of a multicolumn index to be estimated well.

            regards, tom lane

pgsql-general by date:

Previous
From: Ezequiel Tolnay
Date:
Subject: Re: Dumb question about count()
Next
From: Alvaro Herrera
Date:
Subject: Re: Wishlist?