Re: faster SELECT

From: Andrew Rawnsley <ronz(at)ravensfield(dot)com>
To: Chris <list(at)1006(dot)org>
Cc: sferriol <sylvain(dot)ferriol(at)imag(dot)fr>, pgsql-general(at)postgresql(dot)org
Subject: Re: faster SELECT
Date: 2004-03-08 13:34:42
Message-ID: 5B1712B6-7105-11D8-BB72-000393A47FCC@ravensfield.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mar 8, 2004, at 5:40 AM, Chris wrote:

>
>> in a 'SELECT', does postgres read the 'WHERE' condition from left to
>> right.
>
> PostgreSQL (SQL in general?) does NOT define evaluation order (unlike
> programming languages like C).
>

It is a fairly well known optimization in Oracle (at least with the
rule-based optimizer, and IIRC non-indexed clauses) to optimize the
WHERE clause right to left.

>
>> for example
>> 1) select ... where a and b;
>> 2) select ... where b and a;
>>
>> 1 and 2 will use the same cpu time or not ?
>
> Depends on the problem.
> In theory the optimizer should find the best evaluation order
> after analyzing a and b.
>
>
> Bye, Chris.
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
--------------------

Andrew Rawnsley
President
The Ravensfield Digital Resource Group, Ltd.
(740) 587-0114
www.ravensfield.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mimi Siu 2004-03-08 13:43:23 Binary Large object
Previous Message NTPT 2004-03-08 10:49:21 Re: faster SELECT