X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 984F9DACC6 for ; Mon, 24 Oct 2005 12:20:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53957-09 for ; Mon, 24 Oct 2005 15:20:28 +0000 (GMT) Received: from mail.informatik.hu-berlin.de (mail.informatik.hu-berlin.de [141.20.20.50]) by svr1.postgresql.org (Postfix) with ESMTP id 3AF35DABF0 for ; Mon, 24 Oct 2005 12:20:27 -0300 (ADT) Received: from [141.20.27.143] (karotte.informatik.hu-berlin.de [141.20.27.143]) (authenticated bits=0) by mail.informatik.hu-berlin.de (8.13.4+Sun/8.13.4/INF-2.0-MA-SOLARIS-2.10) with ESMTP id j9OFKNr1026787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Oct 2005 17:20:23 +0200 (CEST) Message-ID: <435CFBB6.2010303@informatik.hu-berlin.de> Date: Mon, 24 Oct 2005 17:20:22 +0200 From: Silke Trissl User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050727 X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?KOI8-R?Q?=E9=CC=D8=D1_=EB=CF=CE=C0=C8=CF=D7?= Cc: pgsql-sql@postgresql.org Subject: Re: References: In-Reply-To: X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable X-Virus-Status: No (mail) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200510/261 X-Sequence-Number: 23114 =E9=CC=D8=D1 =EB=CF=CE=C0=C8=CF=D7 wrote: >>For example, consider the queres: >> >>SELECT * FROM table1 WHERE field1=3D1 AND field2=3D1; >> >>SELECT * FROM table1 WHERE field2=3D1 AND field1=3D1; >> >> >>These two queries are logically equivalent. But in all cases the planne= r generates a query plan that performs field1=3D1 condition, and then fie= ld2=3D1 condition, as there is a index on field1. >> >>Is it possible to instruct the PostgreSQL query planner to perform fiel= d2=3D1 condition first, and then field1=3D1 condition? >> You might get the desired result, if you switch off the index scan: set ENABLE_INDEXSCAN =3D 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. =09 Hope, that helps Silke