Re: statistics horribly broken for row-wise comparison - Mailing list pgsql-hackers

From Tom Lane
Subject Re: statistics horribly broken for row-wise comparison
Date
Msg-id 2973.1236051231@sss.pgh.pa.us
Whole thread Raw
In response to Re: statistics horribly broken for row-wise comparison  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: statistics horribly broken for row-wise comparison  (Greg Stark <stark@enterprisedb.com>)
List pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> On Mon, Mar 2, 2009 at 8:29 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Merlin Moncure <mmoncure@gmail.com> writes:
>>> It looks like for row-wise comparison, only the first column is used
>>> for generating the expected row count.
>> 
>> [ shrug... ] �Short of multi-column statistics, it's hard to see how to
>> do better.

> hm... Why can't you just multiply the range estimates for the fields
> together when doing an operation over the key?

Because it would be the wrong answer, except in the uncommon case where
the field values are completely independent (at least, I would expect
that to be uncommon when people have multicolumn indexes on them).

In the case at hand, I think you're barking up the wrong tree anyway.
It's much more likely that what we need to do is fix
clauselist_selectivity to recognize range conditions involving
RowCompareExprs.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: statistics horribly broken for row-wise comparison
Next
From: ITAGAKI Takahiro
Date:
Subject: Re: Immediate shutdown and system(3)