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 AE588D1B4EC for ; Wed, 1 Oct 2003 12:39:50 +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 24711-03 for ; Wed, 1 Oct 2003 09:39:04 -0300 (ADT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id CFEBAD1B4F2 for ; Wed, 1 Oct 2003 09:39:00 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 1A4gG0-000EOD-0V; Wed, 01 Oct 2003 13:39:04 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id E11C815A42; Wed, 1 Oct 2003 13:39:02 +0100 (BST) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 425C01599F; Wed, 1 Oct 2003 13:39:02 +0100 (BST) From: Richard Huxton To: "Mindaugas Riauba" , Subject: Re: What is the fastest null WHERE Date: Wed, 1 Oct 2003 13:39:01 +0100 User-Agent: KMail/1.5 References: <07c001c38815$29277b90$f20214ac@bite.lt> In-Reply-To: <07c001c38815$29277b90$f20214ac@bite.lt> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1257" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310011339.01707.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/12 X-Sequence-Number: 3760 On Wednesday 01 October 2003 13:11, 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? I suspect WHERE true, but is it really necessary. Most languages will have a join() operator that lets you do something like: $where_cond = join(' AND ', @list_of_tests) -- Richard Huxton Archonet Ltd