Re:

From: Silke Trissl <trissl(at)informatik(dot)hu-berlin(dot)de>
To: Илья Конюхов <ilyakon(at)mail(dot)ru>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re:
Date: 2005-10-24 15:20:22
Message-ID: 435CFBB6.2010303@informatik.hu-berlin.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Илья Конюхов wrote:
>>For example, consider the queres:
>>
>>SELECT * FROM table1 WHERE field1=1 AND field2=1;
>>
>>SELECT * FROM table1 WHERE field2=1 AND field1=1;
>>
>>
>>These two queries are logically equivalent. But in all cases the planner generates a query plan that performs field1=1 condition, and then field2=1 condition, as there is a index on field1.
>>
>>Is it possible to instruct the PostgreSQL query planner to perform field2=1 condition first, and then field1=1 condition?
>>
You might get the desired result, if you switch off the index scan:

set ENABLE_INDEXSCAN = OFF.

But there is no way to tell Postgres what to use first. Usually the
query planer is quite good, so there is no reason to fiddle around. And
why on earth would you like that. In the end you get the same result.


Hope, that helps

Silke

In response to

  • at 2005-10-24 15:08:59 from Илья Конюхов

Browse pgsql-sql by date

  From Date Subject
Next Message Cristian Prieto 2005-10-24 16:31:56 Re: Problema con migracion de SQL a PostgreSQL
Previous Message Tom Lane 2005-10-24 15:14:47 Re: Blank-padding