Re: Rearranging simple where clauses - Mailing list pgsql-general

From Tom Lane
Subject Re: Rearranging simple where clauses
Date
Msg-id 12252.1304524197@sss.pgh.pa.us
Whole thread Raw
In response to Re: Rearranging simple where clauses  (Michael Graham <mgraham@bloxx.com>)
Responses Re: Rearranging simple where clauses
List pgsql-general
Michael Graham <mgraham@bloxx.com> writes:
> I did suspect that the answer would be that the difficulty out ways the
> benefit.  But in terms of driving the planner don't we always want to be
> looking to move all the constants to one side of the expression since
> the planner seems to like those?

Well, you failed to show us any concrete examples of the cases you were
looking at, but no I don't think the planner necessarily likes "all the
constants on one side".  Most likely the win cases are where one side of
a WHERE-condition operator exactly matches an index, so you'd need to be
looking for places where rearrangement could make that happen.

            regards, tom lane

pgsql-general by date:

Previous
From: Michael Graham
Date:
Subject: Re: Rearranging simple where clauses
Next
From: Marek Więckowski
Date:
Subject: Re: auto-reconnect: temp schemas, sequences, transactions