Re: correlation in pg_stats

From: pgsql(at)mohawksoft(dot)com
To: "Ron Mayer" <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, rm_pg(at)cheapcomplexdevices(dot)com
Subject: Re: correlation in pg_stats
Date: 2005-02-08 18:04:52
Message-ID: 16503.24.91.171.78.1107885892.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Short summary:
>
> * It looks to me like the planner vastly overestimates
> the # of pages read by index scan in quite a few of my
> tables even though stats collected by ANALYZE are correct.
>
> * The problem happens any time you have multiple columns
> that have a number of repeated values in them, and
> you CLUSTER the table by a sort using both columns
> (like "city,state,zip,phone#" or "firstname,lastname").
>
> * I think this is the problem that Mark Kirkwood is seeing
> in his threads Query optimizer 8.0.1 and "One Big trend
> vs multiple smaller trends" in hackers.

actually pgsql(at)mohawksoft(dot)com, is Mark Woodward. Pleased to meet you.
:)

(I hate using my name on lists like this because of spammers)

>
> * A test script demonstrating the issue also follows.
>
> * I think keeping one more stat per attribute in
> pg_stastic that could describe this behavior.
>
>
> Longer:
>
>
> If I understand the optimizer correctly, correlation is used
> to both guess how much random disk access will be required in
> a query; as well as estimate how many pages will be read.
>
> Unfortunately, many tables in my larger databases have
> columns with values that are tightly packed on a few pages;
> even though there is no total-ordering across the whole table.
> Stephan Szabo described this as a "clumping effect":
> http://archives.postgresql.org/pgsql-performance/2003-01/msg00286.php

Yes.

I think we are describing the exact same issue.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2005-02-08 18:10:58 Re: PHP/PDO Database Abstraction Layer
Previous Message Greg Stark 2005-02-08 17:51:25 Re: Cross column statistics