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 15:49:57
Message-ID: 12252.1304524197@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Graham <mgraham(at)bloxx(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marek Więckowski 2011-05-04 15:57:37 Re: auto-reconnect: temp schemas, sequences, transactions
Previous Message Michael Graham 2011-05-04 15:35:12 Re: Rearranging simple where clauses