Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ui3Lg-0005LB-Lb for pgsql-performance@arkaria.postgresql.org; Thu, 30 May 2013 13:57:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Ui3Lg-0002Si-5P for pgsql-performance@arkaria.postgresql.org; Thu, 30 May 2013 13:57:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ui3Lf-0002Sd-2A for pgsql-performance@postgresql.org; Thu, 30 May 2013 13:56:59 +0000 Received: from szxga01-in.huawei.com ([119.145.14.64]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ui3LP-0007Vh-Hw for pgsql-performance@postgresql.org; Thu, 30 May 2013 13:56:58 +0000 Received: from 172.24.2.119 (EHLO szxeml212-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BCY49617; Thu, 30 May 2013 21:55:59 +0800 (CST) Received: from SZXEML449-HUB.china.huawei.com (10.82.67.192) by szxeml212-edg.china.huawei.com (172.24.2.181) with Microsoft SMTP Server (TLS) id 14.1.323.7; Thu, 30 May 2013 21:55:58 +0800 Received: from blrprnc09ns (10.18.96.98) by szxeml449-hub.china.huawei.com (10.82.67.192) with Microsoft SMTP Server id 14.1.323.7; Thu, 30 May 2013 21:55:58 +0800 From: Amit Kapila To: "'Josh Berkus'" , References: <51A699E6.3000008@agliodbs.com> In-Reply-To: <51A699E6.3000008@agliodbs.com> Subject: Re: Performance bug in prepared statement binding in 9.2? Date: Thu, 30 May 2013 19:25:57 +0530 Message-ID: <00b301ce5d3d$697449a0$3c5cdce0$@kapila@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac5cysDpv1AyH2FcS7uAjeB8ieb6IAAcN02Q Content-Language: en-us X-Originating-IP: [10.18.96.98] X-CFilter-Loop: Reflected X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On Thursday, May 30, 2013 5:45 AM Josh Berkus wrote: > Folks, >=20 > I'm seeing what may be a major performance bug in BIND in 9.2.4. >=20 > We have a client who has an application which uses > Tomcat+Hibernate+JDBC. They are in the process of upgrading this > application from 8.4.17 to 9.2.4. As part of this, they have been > doing > performance testing, and 9.2 is coming out MUCH worse than 8.4. The > problem appears to be bind/plan time. >=20 > Their application does not use prepared queries usefully, doing > parse,bind,execute on every query cycle. >=20 > Here's timings overall for 29 test cycles (cycle 1 has been omitted). > As you can see, parse+execute times are pretty much constant, as are > application think times, but bind times vary quite a lot. In 8.4, the > 29 cycles are constantly 4.5min to 5.75min long. In 9.2, which is the > chart below, they are all over the place. I think it might be because of choosing custom plan option due to which it = might be generating new plan during exec_bind_message(). exec_bind_message()->GetCachedPlan()->choose_custom_plan(). If it chooses c= ustom plan, then it will regenerate the plan which can cause extra cost observed in test. Though there is calculation that it should not choose custom plan always, b= ut still I guess the variation observed in the test can be due to this reas= on. To test if this is the cause, we might hack the code such that it always ch= ooses generic plan, so that it doesn't need to generate plan again. With Regards, Amit Kapila. --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance