Re: statistics horribly broken for row-wise comparison

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: statistics horribly broken for row-wise comparison
Date: 2009-03-03 03:33:51
Message-ID: 2973.1236051231@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> On Mon, Mar 2, 2009 at 8:29 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Merlin Moncure <mmoncure(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ITAGAKI Takahiro 2009-03-03 03:43:37 Re: Immediate shutdown and system(3)
Previous Message Merlin Moncure 2009-03-03 03:14:49 Re: statistics horribly broken for row-wise comparison