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 7678ADAB8A for ; Sun, 23 Oct 2005 03:50:10 -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 25042-10 for ; Sun, 23 Oct 2005 06:50:07 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 5F17DDAB9D for ; Sun, 23 Oct 2005 03:50:07 -0300 (ADT) Received: (qmail 13577 invoked by uid 500); 23 Oct 2005 06:51:36 -0000 Date: Sun, 23 Oct 2005 01:51:36 -0500 From: Bruno Wolff III To: mark@mark.mielke.cc Cc: pgsql-performance@postgresql.org Subject: Re: prepared transactions that persist across sessions? Message-ID: <20051023065136.GA12238@wolff.to> Mail-Followup-To: Bruno Wolff III , mark@mark.mielke.cc, pgsql-performance@postgresql.org References: <20051023041423.GA11639@mark.mielke.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051023041423.GA11639@mark.mielke.cc> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 required=5 tests=[AWL=0.007] X-Spam-Level: X-Archive-Number: 200510/312 X-Sequence-Number: 15080 On Sun, Oct 23, 2005 at 00:14:23 -0400, mark@mark.mielke.cc wrote: > Hey all. > > Please point me to a place I should be looking if this is a common > question that has been debated periodically and at great length > already. :-) You probably want to read: http://candle.pha.pa.us/main/writings/pgsql/sgml/runtime-config-query.html Connection pooling might be another approach, since it should be possible to reuse prepared statements when reusing a connection. > I have a complex query. It's a few Kbytes large, and yes, I've already > worked on reducing it to be efficient in terms of database design, and > minimizing the expressions used to join the tables. Running some timing > tests, I've finding that the query itself, when issued in full, takes > around 60 milliseconds to complete on modest hardware. If prepared, and > then executed, however, it appears to take around 60 milliseconds to > prepare, and 20 milliseconds to execute. I'm not surprised. PostgreSQL > is very likely calculating the costs of many, many query plans.