Re: Index correlation versus multi-column indexes

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org, Maxim Boguk <mboguk(at)masterhost(dot)ru>
Subject: Re: Index correlation versus multi-column indexes
Date: 2009-02-27 23:01:14
Message-ID: 1235775674.17675.11.camel@dell.linuxdev.us.dell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2009-02-27 at 13:25 -0500, Tom Lane wrote:
> So apparently we need to rethink this, and derate the correlation effect
> somehow when there are constraints on non-first columns. I'm not
> entirely sure what the model ought to be. Thoughts?

This seems similar to the problem of estimating correlation for a GiST
index (as I recall you mentioned before that we should be tracking
correlation per-index rather than per-attribute).

Unless we get significantly smarter about what "correlation" means, I
think its only purpose is for very simple range scans. And, as you point
out, a selective predicate on a non-first attribute means that it's not
really a range scan.

I don't see an easy solution to this other than just saying that a
predicate on a second attribute is not a range scan at all, unless the
predicate is not very selective.

Regards,
Jeff Davis

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-02-27 23:30:29 pgsql: Temporarily (I hope) disable flattening of IN/EXISTS sublinks
Previous Message Jaime Casanova 2009-02-27 22:59:05 Re: Updates of SE-PostgreSQL 8.4devel patches (r1530)