Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D199263307E for ; Wed, 13 May 2009 19:31:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 77351-05 for ; Wed, 13 May 2009 19:31:05 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f178.google.com (mail-gx0-f178.google.com [209.85.217.178]) by mail.postgresql.org (Postfix) with ESMTP id 9F0CB630861 for ; Wed, 13 May 2009 19:31:05 -0300 (ADT) Received: by gxk26 with SMTP id 26so1778203gxk.19 for ; Wed, 13 May 2009 15:31:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=S0B/W227r9mMGGZep9UnwmuMbJBoA2Y5CRQxenr2pTM=; b=DCKpHHNJZE9/WKVZFec2j6FmkjBLZwc0dUdFmxvH5kAsHnNTp3ctvVqjHJXx0OvqCN UutDbl5mzi11yiV1Z4ghsUDXl1XDPwAsHecE7Pq505kgKYw9EWfvmu1ZO95GzapTmgYQ 3397dn+T5R+Q82KULhvlncHu94iSOwYiSq3tc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=kVcYO2bZVWvrXcPS19dsBxxMbiqwT8FIhEUsCcAqbxi3KcfhiHzpIJYGdGZy1Fb/VM Uqyb2m9UT/PqmV5CtjlIEoXKRdGz7qOt/A5rkUXS6swA+Z7AqSeAkZboCVv94X9J+gXY 4O1dOssyBhW/0nkT0BVpkFE1p0fqPiPXzQnhw= MIME-Version: 1.0 Received: by 10.90.117.17 with SMTP id p17mr1164748agc.87.1242253864481; Wed, 13 May 2009 15:31:04 -0700 (PDT) In-Reply-To: <4A0B24E3.3070301@fcon.no> References: <4A0978A3.6030900@fcon.no> <4A099C8F.60709@kickstone.com> <4A09C4E6.3010408@fcon.no> <4A09D04B.9070206@kickstone.com> <4A0A7D50.40704@fcon.no> <03C41048CEFD45DD97AC0DD884C8A21A@squarepi.com> <491f66a50905130821j6afa056fp947e4dbcfd09d701@mail.gmail.com> <4A0B24E3.3070301@fcon.no> Date: Wed, 13 May 2009 18:31:03 -0400 X-Google-Sender-Auth: 09d6ad0b31e9861d Message-ID: <491f66a50905131531x774b2a3ds7813b075562cd83f@mail.gmail.com> Subject: Re: pooled prepared statements From: Dave Cramer To: Thomas Finneid Cc: John Lister , pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=0016361e88905036090469d2c441 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200905/77 X-Sequence-Number: 19627 --0016361e88905036090469d2c441 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I still think you will have multiple prepared statements one per connection regardless of if it uses a procedure, and you would have to prepare the statement on first use and then store it in the session. Dave On Wed, May 13, 2009 at 3:52 PM, Thomas Finneid wrote: > > Maybe your right. The query processing takes from 1-10 seconds, so planning > it is not a big factor. But when the load becomes higher, as it will be as > the data increases, the planning might possibly eat time which could be used > elsewhere. > > My server, as it is now, is pushing the limits of postgres for my use, so > maybe I need to reclaim as much of wasted time as possible... > > We'll see. > > thomas > > Dave Cramer wrote: > > >> >> On Wed, May 13, 2009 at 10:37 AM, John Lister > john.lister@kickstone.com>> wrote: >> >> Probably easier to create a server side function >> instead, then. >> >> But wouldn't you still have to go through all the planning >> steps within the function for any queries, although i'll >> admit i'm not familiar with Postgresql functions. >> >> >> Server-side functions are compiled when installed. Since my >> function would only contain simple queries that are >> parameterized, it would pre-compile well. >> >> >> While the function may be compiled, the overhead is the same for preparing >> the statement inside the function. So I don't think it's a huge win. >> >> > --0016361e88905036090469d2c441 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I still think you will have multiple prepared statements one per connection= regardless of if it uses a procedure, and you would have to prepare the st= atement on first use and then store it in the session.

Dave

On Wed, May 13, 2009 at 3:52 PM, Thomas Finneid = <tfinneid@fcon.no<= /a>> wrote:

Maybe your right. The query processing takes from 1-10 seconds, so planning= it is not a big factor. But when the load becomes higher, as it will be as= the data increases, the planning might possibly eat time which could be us= ed elsewhere.

My server, as it is now, is pushing the limits of postgres for my use, so m= aybe I need to reclaim as much of wasted time as possible...

We'll see.

thomas

Dave Cramer wrote:



On Wed, May 13, 2009 at 10:37 AM, John Lister <
john.lister@kickstone.com <mai= lto:john.lis= ter@kickstone.com>> wrote:

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Probably easier to create a server side fun= ction
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0instead, then.

=A0 =A0 =A0 =A0 =A0 =A0But wouldn't you still have to go through all t= he planning
=A0 =A0 =A0 =A0 =A0 =A0steps within the function for any queries, although= i'll
=A0 =A0 =A0 =A0 =A0 =A0admit i'm not familiar with Postgresql function= s.


=A0 =A0 =A0 =A0Server-side functions are compiled when installed. Since my=
=A0 =A0 =A0 =A0function would only contain simple queries that are
=A0 =A0 =A0 =A0parameterized, it would pre-compile well.


While the function may be compiled, the overhead is the same for preparing = the statement inside the function. So I don't think it's a huge win= .



--0016361e88905036090469d2c441--