Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3F4B89FB2F5 for ; Sat, 23 Jun 2007 18:51:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 32902-07 for ; Sat, 23 Jun 2007 18:51:36 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.189]) by postgresql.org (Postfix) with ESMTP id B67039FB2EA for ; Sat, 23 Jun 2007 18:51:41 -0300 (ADT) Received: by mu-out-0910.google.com with SMTP id i10so1561593mue for ; Sat, 23 Jun 2007 14:51:40 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=FX4UrSUXroKHhWPYz2hYZrr1VbwmGZzugli+6YgaSI1fotdrxuzkeuJ4fzzbWonqRniem5vef03X2Mx6yv3j+ZWLwyfqlMg2HbveNxjT6kczmKHAOPYPHZAGfUcBXVl7Zza02ms86BIQvlW9QjjWQQiG8o59F+hQfDXd3vafTd4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=VqH62aA5hEBkoNGXu8TFC4ewJgv8Vuq6rltVJxUVoTx8c4UbmXknoivX27do6F4Zl9NFnHnwRTnHB4NLlACBoP3Dr9tg9WIq106ZJC3+2mrNhUyxeZ0LdTaNM+PSke5w+EMM/8+OQqrvVO99QR5WXUJSdR6xwpj7U/hh4ARM62o= Received: by 10.82.111.8 with SMTP id j8mr9395074buc.1182635499931; Sat, 23 Jun 2007 14:51:39 -0700 (PDT) Received: from ?192.168.1.33? ( [81.107.198.252]) by mx.google.com with ESMTP id f7sm12962926nfh.2007.06.23.14.51.36 (version=SSLv3 cipher=RC4-MD5); Sat, 23 Jun 2007 14:51:38 -0700 (PDT) Message-ID: <467D95C4.4020407@enterprisedb.com> Date: Sat, 23 Jun 2007 22:51:00 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: PFC CC: pgsql-performance@postgresql.org Subject: Re: PREPARE and stuff References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/558 X-Sequence-Number: 25591 PFC wrote: > > Suppose a web application with persistent database connections. > I have some queries which take longer to plan than to execute ! > > I with there was a way to issue a PREPARE (like "PERSISTENT PREPARE"). > Now all Postgres connections would know that prepared statement foo( > $1, $2, $3 ) corresponds to some SQL query, but it wouldn't plan it yet. > Just like a SQL function. > When invoking EXECUTE foo( 1,2,3 ) on any given connection the > statement would get prepared and planned. Then on subsequent invocations > I'd just get the previously prepared plan. How would that be different from the current PREPARE/EXECUTE? Do you mean you could PREPARE in one connection, and EXECUTE in another? If you're using persistent connections, it wouldn't be any faster than doing a PREPARE once in each connection. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com