X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AA93AD1B4E1 for ; Wed, 1 Oct 2003 12:30:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 24557-01 for ; Wed, 1 Oct 2003 09:30:16 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 34424D1B4F2 for ; Wed, 1 Oct 2003 09:30:11 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h91CX1AK028519 for ; Wed, 1 Oct 2003 18:03:01 +0530 Received: from persistent.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h91CX0Nh028493; Wed, 1 Oct 2003 18:03:00 +0530 Message-ID: <3F7AC94E.1000407@persistent.co.in> Date: Wed, 01 Oct 2003 18:02:14 +0530 From: Shridhar Daithankar Organization: Persistent Systems Pvt. Ltd. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030917 Thunderbird/0.3a X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mindaugas Riauba Cc: pgsql-performance@postgresql.org Subject: Re: What is the fastest null WHERE References: <07c001c38815$29277b90$f20214ac@bite.lt> In-Reply-To: <07c001c38815$29277b90$f20214ac@bite.lt> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/11 X-Sequence-Number: 3759 Mindaugas Riauba wrote: > Hello, > > While writing web application I found that it would > be very nice for me to have "null" WHERE clause. Like > WHERE 1=1. Then it is easy to concat additional > conditions just using $query . " AND col=false" syntax. > > But which of the possible "null" clauses is the fastest > one? Rather than this approach, keep a flag which tells you whether or not it is first where condition. If it is not first where condition, add a 'and'. That would be simple, isn't it? Shridhar