Re: Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102

From: Edson Richter <edsonrichter(at)hotmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102
Date: 2016-01-11 13:59:07
Message-ID: BLU436-SMTP142BBDB8DDD36C19E3CEE21CFC90@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

I can confirm, It really behave differently, but not for the same reason
as yours.
In my case, problema is that after optimization at server side, results
get different.

I always work with url parameter:

jdbc:postgresql://dbdevel:5433/mydatabase?prepareThreshold=0

When using prepareThreshold=0, I do avoid the server side prepared
statements.

My be worth to give a try, since would also makes difference for you as
well.

Atenciosamente,

Edson Carlos Ericksson Richter

Em 11/01/2016 11:33, Dave Cramer escreveu:
> It's not that JDBC is slower, it is the plans that are being generated
> are slower. I can't imagine why that would even happen.
>
> JDBC doesn't really change the incoming SQL
>
> Dave Cramer
>
> davec(at)postgresintl(dot)com <mailto:davec(at)postgresintl(dot)com>
> www.postgresintl.com <http://www.postgresintl.com>
>
> On 11 January 2016 at 08:29, Christian Bjørnbak <cbj(at)touristonline(dot)dk
> <mailto:cbj(at)touristonline(dot)dk>> wrote:
>
> @Vladimir but if 1202+ has become smarter than 1102 and reuse
> prepared statements more often how come Thomas experience the 1207
> to be magnitudes slower?
>
> Shouldn't it be the other way around?
>
>
>
> Med venlig hilsen / Kind regards,
>
> Christian Bjørnbak
>
> Chefudvikler / Lead Developer
> TouristOnline A/S
> Islands Brygge 43
> 2300 København S
> Denmark
> TLF: +45 32888230 <tel:%2B45%2032888230>
> Dir. TLF: +45 32888235 <tel:%2B45%2032888235>
>
> 2016-01-11 14:05 GMT+01:00 Vladimir Sitnikov
> <sitnikov(dot)vladimir(at)gmail(dot)com <mailto:sitnikov(dot)vladimir(at)gmail(dot)com>>:
>
> The difference is as follows: 1202 can cache across
> statement.close()
> calls. 1201 can't do that.
>
> In other words, to use server-prepared statements in previous
> versions, you had to reuse the *same* PreparedStatement
> *object* again
> and again. As soon as you issue .close() you lose your shiny
> server-prepared statement.
>
> Typical applications are written in a form of
> PreparedStatement ps = con.prepareStatement(sql);
> ps.excuteQuery();
> ps.close();
>
> In other words, almost always developers just recreate
> PreparedStatement and close it.
> The improvement of 1202 was to identify such patterns and use
> server-prepared statement in such cases as well.
> Vladimir
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org
> <mailto:pgsql-jdbc(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vladimir Sitnikov 2016-01-11 14:14:28 Re: Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102
Previous Message Thomas Kellerer 2016-01-11 13:57:17 Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2016-01-11 14:14:28 Re: Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102
Previous Message Thomas Kellerer 2016-01-11 13:57:17 Re: 9.4-1207 behaves differently with server side prepared statements compared to 9.2-1102