Re: proposal : cross-column stats - Mailing list pgsql-hackers

From Robert Haas
Subject Re: proposal : cross-column stats
Date
Msg-id AANLkTimVUvrfZyGcV8seuT8Mrq+7xGgdRA4XJ6aRtDJV@mail.gmail.com
Whole thread Raw
In response to Re: proposal : cross-column stats  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: proposal : cross-column stats  (Tomas Vondra <tv@fuzzy.cz>)
List pgsql-hackers
On Sun, Dec 12, 2010 at 9:43 AM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> The way I think of that problem is that once you know the postcode, knowing
> the city name doesn't add any information. The postcode implies the city
> name. So the selectivity for "postcode = ? AND city = ?" should be the
> selectivity of "postcode = ?" alone. The measurement we need is
> "implicativeness": How strongly does column A imply a certain value for
> column B. Perhaps that could be measured by counting the number of distinct
> values of column B for each value of column A, or something like that. I
> don't know what the statisticians call that property, or if there's some
> existing theory on how to measure that from a sample.

This is a good idea, but I guess the question is what you do next.  If
you know that the "applicability" is 100%, you can disregard the
restriction clause on the implied column.  And if it has no
implicatory power, then you just do what we do now.  But what if it
has some intermediate degree of implicability?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Next
From: Tom Lane
Date:
Subject: Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED