X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 881E8DABC4 for ; Sun, 23 Oct 2005 21:14:36 -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 13039-01 for ; Mon, 24 Oct 2005 00:14:33 +0000 (GMT) Received: from mail25.sea5.speakeasy.net (mail25.sea5.speakeasy.net [69.17.117.27]) by svr1.postgresql.org (Postfix) with ESMTP id B4F50DABA0 for ; Sun, 23 Oct 2005 21:14:34 -0300 (ADT) Received: (qmail 27340 invoked from network); 24 Oct 2005 00:14:37 -0000 Received: from dsl017-073-250.chi4.dsl.speakeasy.net (HELO mofo.meme.com) ([69.17.73.250]) (envelope-sender ) by mail25.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 24 Oct 2005 00:14:37 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id A2EF86E422; Sun, 23 Oct 2005 19:25:09 -0500 (CDT) Date: Mon, 24 Oct 2005 00:25:09 +0000 From: "Karl O. Pinc" Subject: Re: Using LIMIT 1 in plpgsql PERFORM statements To: Josh Berkus Cc: pgsql-performance@postgresql.org References: <1129957521l.27845l.2l@mofo> <200510231402.35612.josh@agliodbs.com> In-Reply-To: <200510231402.35612.josh@agliodbs.com> (from josh@agliodbs.com on Sun Oct 23 16:02:35 2005) X-Mailer: Balsa 2.3.0 Message-Id: <1130113509l.8670l.1l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 required=5 tests=[AWL=-0.000, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/323 X-Sequence-Number: 15091 On 10/23/2005 04:02:35 PM, Josh Berkus wrote: > Karl, > > > PERFORM 1 FROM foo; > > IF FOUND THEN ... > > > > is any slower than: > > > > PERFORM 1 FROM foo LIMIT 1; > > IF FOUND THEN ... > > I'm wondering in what context it makes sense to call PERFORM on a > constant. If you want to find out if the table has any rows. I'm really interested in what happens when there's a WHERE qualification. I want to find out if there's any of some particular sort of row. But I figured it wasn't worth putting that into the example because I didn't have anything specific to put in the WHERE clause. I suppose I should have put it in anyway and followed with .... Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein