Skip site navigation (1) Skip section navigation (2)

Re: Rearranging simple where clauses

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Graham <mgraham(at)bloxx(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Rearranging simple where clauses
Date: 2011-05-04 14:49:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Michael Graham <mgraham(at)bloxx(dot)com> 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 no one has go around to doing it or is there some
> deeper reasons?  It's not really important I'm just curious.

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 queries where it'd
actually help doesn't seem to be that large.  I've seen one or two
complaints about that sort of thing, but it's way way down the list
of serious problems.

			regards, tom lane

In response to


pgsql-general by date

Next:From: Scott RibeDate: 2011-05-04 15:07:30
Subject: SSDD reliability
Previous:From: Merlin MoncureDate: 2011-05-04 14:32:15
Subject: Re: pervasiveness of surrogate (also called synthetic) keys

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group