Re: Planner not using column limit specified for one column for another column equal to first - Mailing list pgsql-performance

From Yeb Havinga
Subject Re: Planner not using column limit specified for one column for another column equal to first
Date
Msg-id 4BC88364.9050404@gmail.com
Whole thread Raw
In response to Re: Planner not using column limit specified for one column for another column equal to first  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Planner not using column limit specified for one column for another column equal to first
List pgsql-performance
Tom Lane wrote:
> =?KOI8-U?B?96bUwcymyiD0yc3eydvJzg==?= <tivv00@gmail.com> writes:
>
>> I've thought and someone in this list've told me that this should be done
>> automatically.
>>
>
> No, that's not true.  We do make deductions about transitive equalities,
> ie, given WHERE a=b AND b=c the planner will infer a=c and use that if
> it's helpful.  We don't make deductions about inequalities such as a>c.
> In theory there's enough information available to do so, but overall
> trying to do that would probably waste more cycles than it would save.
> You'd need a lot of expensive new planner infrastructure, and in the
> vast majority of queries it wouldn't produce anything very helpful.
>
New expensive planner infrastructure to support from a>b and b>c infer
a>c, yes.

But I wonder if something like Leibniz's principle of identity holds for
members of the same equivalence class, e.g. like if x,y are both members
of the same EC, then for every predicate P, P(x) iff P(y). Probably not
for every predicate (like varno = 2 or attname='x'), but for the query
evaluation, the object denoted by the variables are the same, since that
is the standard meaning of the = operator. I cannot think of any
standard (btree) operator where 'Leibniz' would fail in this case.

regards,
Yeb Havinga



pgsql-performance by date:

Previous
From: Josh Kupershmidt
Date:
Subject: Re: stats collector suddenly causing lots of IO
Next
From: Tom Lane
Date:
Subject: Re: stats collector suddenly causing lots of IO