X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D6FE19DCA82 for ; Fri, 20 Jan 2006 11:14:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86721-07 for ; Fri, 20 Jan 2006 11:14:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by postgresql.org (Postfix) with ESMTP id D74349DCA7B for ; Fri, 20 Jan 2006 11:14:50 -0400 (AST) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id CD65C239472; Fri, 20 Jan 2006 10:14:55 -0500 (EST) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 99161-01-9; Fri, 20 Jan 2006 10:14:54 -0500 (EST) Received: from [192.168.1.104] (d38-160-188.home1.cgocable.net [72.38.160.188]) by mailbox.samurai.com (Postfix) with ESMTP id 2F9BB23945C; Fri, 20 Jan 2006 10:14:54 -0500 (EST) Subject: Re: Retaining execution plans between connections? From: Neil Conway To: James Russell Cc: pgsql-performance@postgresql.org In-Reply-To: <3a3a16930601200114p27ccb3fdn750286898f39c405@mail.gmail.com> References: <3a3a16930601200114p27ccb3fdn750286898f39c405@mail.gmail.com> Content-Type: text/plain Date: Fri, 20 Jan 2006 10:14:59 -0500 Message-Id: <1137770099.9330.12.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.117 required=5 tests=[AWL=0.117] X-Spam-Score: 0.117 X-Spam-Level: X-Archive-Number: 200601/339 X-Sequence-Number: 16817 On Fri, 2006-01-20 at 18:14 +0900, James Russell wrote: > I am looking to speed up performance, and since each page executes a > static set of queries where only the parameters change, I was hoping > to take advantage of stored procedures since I read that PostgreSQL's > caches the execution plans used inside stored procedures. Note that you can also take advantage of plan caching by using prepared statements (PREPARE, EXECUTE and DEALLOCATE). These are also session local, however (i.e. you can't share prepared statements between connections). > As I said, I can't share the DB connection between pages (unless > someone knows of a way to do this and still retain a level of > separation between pages that use the same DB connection). You can't share plans among different sessions at the moment. Can you elaborate on why you can't use persistent or pooled database connections? -Neil