From: Илья Конюхов <ilyakon(at)mail(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject:
Date: 2005-10-24 15:08:59
Message-ID: E1EU3wZ-000Fgr-00.ilyakon-mail-ru@f21.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

EXPLAIN [ ANALYZE ] [ VERBOSE ] statement
This command displays the execution plan that the PostgreSQL planner generates for the supplied statement.

This command displays plan ONLY! But I want to instruct the PostgreSQL query planner to perform field2=1 condition first, and then field1=1 condition.

Responses

  • Re: at 2005-10-24 15:20:22 from Silke Trissl

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-10-24 15:14:47 Re: Blank-padding
Previous Message Shaun Watts 2005-10-24 15:04:39 Re: Blank-padding