pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marko Tiikkaja <marko@joh.to>
To: Dave Cramer <pg@fastcrypt.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Fwd: [JDBC] Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102
Date: Tue, 12 Jan 2016 13:15:23 +0100
Message-ID: <5694EE5B.1030203@joh.to> (raw)
In-Reply-To: <CADK3HHLn46DhtfgsnLnpvFhZHHnj3x3vohmF9V53RRtbFacK4w@mail.gmail.com>
References: <n708gj$348$1@ger.gmane.org>
	<CAB=Je-FWxz+vQQaXLS7kP1rzCFVjdVVJg+vzq7DDF66ASddy8Q@mail.gmail.com>
	<n70912$ap6$1@ger.gmane.org>
	<CAB=Je-Ea77aCTYVQPURxuDV34099ZotXGstC5kXbvhaLq4yYmQ@mail.gmail.com>
	<CAAQEOtxyXLt-asBtYE8GY-+MjdeOhp=1o+0YVOqmLjxD4EzsgQ@mail.gmail.com>
	<CADK3HHJgd4YJyh4qjxouBg=dPc463fiUjUjDOkgkeQq-bqqDJQ@mail.gmail.com>
	<CAB=Je-Gp2NmGs5KDBwUGL36UGko8x89n=VQjLS+u2GYSKwjKSA@mail.gmail.com>
	<CADK3HH+GZa+USn1iD_DCoVPF0k8WiM9R6Ms6moV_EbC2fwusLg@mail.gmail.com>
	<n70f5b$j8k$1@ger.gmane.org>
	<CADK3HHJFGjNXJns4exfw_NMGvKAR-1g2RTwvHcbVKK65kuHgEg@mail.gmail.com>
	<n72fhe$cf8$1@ger.gmane.org>
	<CADK3HHLn46DhtfgsnLnpvFhZHHnj3x3vohmF9V53RRtbFacK4w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 12/01/16 13:00, Dave Cramer wrote:
> We have an interesting problem, and the reporter has been kind enough to
> provide logs for which we can't explain.
>
> I'd be interested to hear any plausible explanations for a prepared plan
> suddenly going from 2ms to 60ms for the same input values ?

This is a new feature in 9.2, where on the fifth (or sixth, not sure) 
execution the planner might choose to use a generic plan.  From the 9.2 
release notes (though I'm fairly certain this is documented somewhere in 
the manual as well):

In the past, a prepared statement always had a single "generic" plan 
that was used for all parameter values, which was frequently much 
inferior to the plans used for non-prepared statements containing 
explicit constant values. Now, the planner attempts to generate custom 
plans for specific parameter values. A generic plan will only be used 
after custom plans have repeatedly proven to provide no benefit. This 
change should eliminate the performance penalties formerly seen from use 
of prepared statements (including non-dynamic statements in PL/pgSQL).


.m


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



view thread (72+ messages)  latest in thread

Message-ID: <5694EE5B.1030203@joh.to>
Permalink:  ../5694EE5B.1030203@joh.to/
Also on:    postgresql.org/message-id/5694EE5B.1030203@joh.to

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: marko@joh.to, pg@fastcrypt.com, pgsql-hackers@postgresql.org
  Subject: Re: Fwd: [JDBC] Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102
  In-Reply-To: <5694EE5B.1030203@joh.to>
  References: <n708gj$348$1@ger.gmane.org> <CAB=Je-FWxz+vQQaXLS7kP1rzCFVjdVVJg+vzq7DDF66ASddy8Q@mail.gmail.com> <n70912$ap6$1@ger.gmane.org> <CAB=Je-Ea77aCTYVQPURxuDV34099ZotXGstC5kXbvhaLq4yYmQ@mail.gmail.com> <CAAQEOtxyXLt-asBtYE8GY-+MjdeOhp=1o+0YVOqmLjxD4EzsgQ@mail.gmail.com> <CADK3HHJgd4YJyh4qjxouBg=dPc463fiUjUjDOkgkeQq-bqqDJQ@mail.gmail.com> <CAB=Je-Gp2NmGs5KDBwUGL36UGko8x89n=VQjLS+u2GYSKwjKSA@mail.gmail.com> <CADK3HH+GZa+USn1iD_DCoVPF0k8WiM9R6Ms6moV_EbC2fwusLg@mail.gmail.com> <n70f5b$j8k$1@ger.gmane.org> <CADK3HHJFGjNXJns4exfw_NMGvKAR-1g2RTwvHcbVKK65kuHgEg@mail.gmail.com> <n72fhe$cf8$1@ger.gmane.org> <CADK3HHLn46DhtfgsnLnpvFhZHHnj3x3vohmF9V53RRtbFacK4w@mail.gmail.com> <5694EE5B.1030203@joh.to>

* 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