pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <amit.kapila@huawei.com>
To: 'Josh Berkus' <josh@agliodbs.com>
To: pgsql-performance@postgresql.org
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> (raw)
In-Reply-To: <51A699E6.3000008@agliodbs.com>
References: <51A699E6.3000008@agliodbs.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On Thursday, May 30, 2013 5:45 AM Josh Berkus wrote:
> Folks,
> 
> I'm seeing what may be a major performance bug in BIND in 9.2.4.
> 
> 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.
> 
> Their application does not use prepared queries usefully, doing
> parse,bind,execute on every query cycle.
> 
> 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 custom 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, but still I guess the variation observed in the test can be due to this reason.

To test if this is the cause, we might hack the code such that it always chooses generic plan, so that it doesn't need to generate plan again.

With Regards,
Amit Kapila.



-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (43+ messages)  latest in thread

Message-ID: <00b301ce5d3d$697449a0$3c5cdce0$@kapila@huawei.com>
Permalink:  ../00b301ce5d3d$697449a0$3c5cdce0$@kapila@huawei.com/
Also on:    postgresql.org/message-id/00b301ce5d3d$697449a0$3c5cdce0$@kapila@huawei.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: amit.kapila@huawei.com, josh@agliodbs.com
  Subject: Re: Performance bug in prepared statement binding in 9.2?
  In-Reply-To: <00b301ce5d3d$697449a0$3c5cdce0$@kapila@huawei.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox