Re: Stats for multi-column indexes

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Richard Huxton <dev(at)archonet(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>, Jeff Davis <pgsql(at)j-davis(dot)com>, postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Stats for multi-column indexes
Date: 2007-03-21 09:27:19
Message-ID: 1174469239.10829.53.camel@coppola.muc.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2007-03-20 at 18:12, Josh Berkus wrote:
> Tom,
>
> > Actually, I think you don't particularly need stats for that in most
> > cases --- if the planner simply took note that the FK relationship
> > exists, it would know that each row of the FK side joins to exactly
> > one row of the PK side, which in typical cases is sufficient.
>
> Is it? What about the other direction? Currently, doesn't the planner
> assume that the rowcount relationship is 1 to ( child total rows /
> parent total rows) ? That's ok for tables with relatively even
> distribution, but not for skewed ones.

Wouldn't that be improved if the MCVs/histogram of the FK column are
taken into account ? Considering that the FK part is unique, the
skewness in the relationship is completely determined by the FK parts
histogram. That would give at least a lower/upper bound and MCVs to the
relationship.

Cheers,
Csaba.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Csaba Nagy 2007-03-21 09:47:13 Re: Stats for multi-column indexes
Previous Message August Zajonc 2007-03-21 09:13:54 Re: Money type todos?