Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id CB839B5DBF0 for ; Fri, 26 Aug 2011 07:50:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 83176-04 for ; Fri, 26 Aug 2011 10:50:09 +0000 (UTC) X-Greylist: delayed 00:08:02.732167 by SQLgrey-1.7.6 Received: from mail-bw0-f46.google.com (mail-bw0-f46.google.com [209.85.214.46]) by mail.postgresql.org (Postfix) with ESMTP id 21829B5DBE8 for ; Fri, 26 Aug 2011 07:50:08 -0300 (ADT) Received: by bke11 with SMTP id 11so2423137bke.19 for ; Fri, 26 Aug 2011 03:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=lRXlp2S//x1yaSuABIWSwvEMaZsz6OdGz/q9MXoqufE=; b=j62SX28++YczvLA9dL3mRFFcRLp+liKhS7PjXIGGWEkhqQ0/lmneU0ALu5/dshQfxY bjimWaZTmofpOaPx/bFLa4g8Kj4wDCN0JjX1eBrgi0gN+2husvs59Hkiq9DVrC/OUUvO GwaG6jU24GmdVIxmrw8VB8PofO7DNwbj1Nqnk= Received: by 10.204.13.154 with SMTP id c26mr500430bka.235.1314355325728; Fri, 26 Aug 2011 03:42:05 -0700 (PDT) Received: from [192.168.4.160] ([85.183.11.189]) by mx.google.com with ESMTPS id x18sm317264fah.2.2011.08.26.03.42.04 (version=SSLv3 cipher=OTHER); Fri, 26 Aug 2011 03:42:05 -0700 (PDT) Message-ID: <4E57787B.7060909@googlemail.com> Date: Fri, 26 Aug 2011 12:42:03 +0200 From: itb348@googlemail.com User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: pgsql-php@postgresql.org Subject: Re: pdo emulate prepares not working. still getting parse-bind-execute-deallocate in pg log. References: <000401cc63a0$7e3bd7b0$7ab38710$@com> In-Reply-To: <000401cc63a0$7e3bd7b0$7ab38710$@com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.789 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.1, FREEMAIL_FROM=0.001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201108/3 X-Sequence-Number: 4215 Am 26.08.2011 05:30, schrieb mark: > > > Hi all, > > > I am trying to convince some of our php guys to not use prepared statements. > > > The reason for this is, first reasons is we are seeing no benefit IMO. > performance wise nearly all of the statements are being prepared, executed > and then deallocated in nearly all cases. The other times it's probably only > run twice so it's still not a win. > > The second reason is I want to be able to use transaction pooling with > pgbouncer. This is the primary driving force. --snip-- Well, in my systems I make the best of the forced prepare and use my own cache of prepared statements in PHP. Statistics show that some statements are repeated a lot, which might give a benefit in speed. And I am especially against connection pooling because it can give you untraceable errors and just makes your systems more complex. But if you want it: my first test had success. Just add $DBH->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); after creating the connection, do not touch the connection string. /Str