Re: query planner does not canonicalize infix operators - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: query planner does not canonicalize infix operators
Date
Msg-id m2r4vpz7wr.fsf@2ndQuadrant.fr
Whole thread Raw
In response to Re: query planner does not canonicalize infix operators  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: query planner does not canonicalize infix operators
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> More generally, I'm not prepared to buy into the idea that the planner
> should be expected to recognize alternate spellings of "the same"
> expression.  There are too many variants of that idea that are
> infeasible either because the planner doesn't have the necessary
> knowledge, or it does but trying to recognize the equivalence would cost
> an impractical number of planning cycles.  Neither of those objections
> apply to "replace an operator by its underlying function"; but they do
> apply to other comparable requests we've gotten such as "recognize that
> x + 0 is the same as x" or "x + 1 is the same as 1 + x".

Looks like we're missing out some operator properties, like the neutral
element and if the operator is transitive, commutative or associative. I
think I remember us talking about how knowing about operators being
associative would also help optimize a class of join problems.

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Clobbered parameter names via DECLARE in PL/PgSQL
Next
From: Brendan Jurd
Date:
Subject: Re: Clobbered parameter names via DECLARE in PL/PgSQL