Re: faster SELECT

From: "NTPT" <ntpt(at)centrum(dot)cz>
To: "sferriol" <sylvain(dot)ferriol(at)imag(dot)fr>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: faster SELECT
Date: 2004-03-08 10:49:21
Message-ID: 010c01c404fb$03b4cee0$d300a8c0@webpropag.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

----- Původní zpráva -----
Od: "sferriol" <sylvain(dot)ferriol(at)imag(dot)fr>
Komu: <pgsql-general(at)postgresql(dot)org>
Odesláno: 8. března 2004 10:41
Předmět: [GENERAL] faster SELECT

> hello
> in a 'SELECT', does postgres read the 'WHERE' condition from left to right.
>
> 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 ?
>
> sylvain

First should be used the most RESTRICTIVE condition. ie if condition "a" limit output to few rows from many , it should be used first in WHERE . Preferrable condition "a" should be created index aware, so relatively inexpensive index scan can eliminate most of unwanted lines from output. Following this rule should you should be able to create a fastest and low cost query.

So it can not be explicitely told if 1 and 2 will use the sme cpu time in real life

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Rawnsley 2004-03-08 13:34:42 Re: faster SELECT
Previous Message Chris 2004-03-08 10:40:21 Re: faster SELECT