Re: Rearranging simple where clauses

From: "Igor Neyman" <ineyman(at)perceptron(dot)com>
To: "Michael Graham" <mgraham(at)bloxx(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Rearranging simple where clauses
Date: 2011-05-05 13:42:03
Message-ID: F4C27E77F7A33E4CA98C19A9DC6722A2077A9583@EXCHANGE.corp.perceptron.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----Original Message-----
From: Michael Graham [mailto:mgraham(at)bloxx(dot)com]
Sent: Wednesday, May 04, 2011 11:59 AM
To: pgsql-general(at)postgresql(dot)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 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.

The reason I never showed you any was because I don't have any I was
just curious. But yeah making one side match an index exactly is
probably the biggest win.

<I.N.

I think, it'll be probably the "only" win, not the "biggest" - sometimes big, sometimes small.

But, what if there are more than one index based on the column in question? - Which one optimizer is supposed to satisfy by rearranging where clause?

Regards,
Igor Neyman

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Ribe 2011-05-05 14:04:39 Re: SSDD reliability
Previous Message Chris Curvey 2011-05-05 13:23:57 Re: postgres segfaulting on pg_restore