----- Původní zpráva -----
Od: "sferriol" <sylvain.ferriol@imag.fr>
Komu: <pgsql-general@postgresql.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
shouldbe used first in WHERE . Preferrable condition "a" should be created index aware, so relatively inexpensive
indexscan can eliminate most of unwanted lines from output. Following this rule should you should be able to create a
fastestand low cost query.
So it can not be explicitely told if 1 and 2 will use the sme cpu time in real life