-Original Message-
From: Michael Graham [mailto:mgra...@bloxx.com]
Sent: Wednesday, May 04, 2011 11:59 AM
To: pgsql-general@postgresql.org
Subject: Re: Rearranging simple where clauses
On Wed, 2011-05-04 at 11:49 -0400, Tom Lane wrote:
> Well, you failed to show us any concrete examples
On Wed, 2011-05-04 at 11:49 -0400, Tom Lane wrote:
> 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 opera
Michael Graham 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 t
On Wed, 2011-05-04 at 10:49 -0400, Tom Lane wrote:
> Well, it'd require a very large amount of
> type-specific/operator-specific knowledge, and it's not clear what
> would drive the planner towards doing useful rearrangements rather
> than counterproductive ones, and the number of real-world querie
Michael Graham writes:
> I was playing around with some sql in postgres and got to wondering why
> the optimiser can't figure out that rearranging some expressions can
> result in massive improvements in the queue plan. For example id + 5 <
> 100 compared with id < 100 - 5.
> Is it simply that n