Re: Query planner refuses to use index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kilian Hagemann <hagemann1(at)egs(dot)uct(dot)ac(dot)za>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query planner refuses to use index
Date: 2005-07-22 14:17:00
Message-ID: 29291.1122041820@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kilian Hagemann <hagemann1(at)egs(dot)uct(dot)ac(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2005-07-22 14:29:46 Re: Wishlist?
Previous Message Michael Fuhr 2005-07-22 13:23:27 Re: Query planner refuses to use index