From: Michał Niklas <michal.niklas@heuthes.pl>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: Change of format of returned flat value after prepareThreshold
Date: Fri, 16 Oct 2015 13:12:10 +0200
Message-ID: <5620DB8A.60604@heuthes.pl> (raw)
In-Reply-To: <CAB=Je-F5k+wDDU3V4YE+pSyVK7rDOMmucoQy8wnPK7gFEJeh1g@mail.gmail.com>
References: <561F9990.10702@heuthes.pl>
<CAB=Je-H_Q0ezjcBM9gCta=wVZyUKs+7WExwKRuJRdhssq9B8Bg@mail.gmail.com>
<56208B5C.9090803@heuthes.pl>
<CAB=Je-F5k+wDDU3V4YE+pSyVK7rDOMmucoQy8wnPK7gFEJeh1g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
W dniu 16.10.2015 o 12:15, Vladimir Sitnikov pisze:
>> I changed those codes to use System.currentTimeMillis().
>
>> why JDBC or database backend changes format of returned value
>> after my use count reaches prepareThreshold parameter.
>
> We JDBC driver cannot ensure stable string representation of
> non-string data. That might change as database improves. That might
> change as JDBC driver improves.
I hope things improves :-)
I do not complain that this changed, just wanted to know
why this changed.
>> If I set prepareThreshold=5 then I get float in normal notation
>> up to 5th try, and then from 6th try I get this value in
>> scientific notation.
>
> Well, that is thanks to usage of server-prepared statement. In that
> mode, pgjdbc can use binary format of data transfer. It does use
> binary mode for types it knows as it is more efficient to transfer
> and parse.
>
>
>> I do not observe this with JDBC drivers in version 9.3,
>
> The thing is older versions did not manage to use server-prepared
> statements for prepareStatement(); .call(); Recently pgjdbc learned
> to use server-prepared statement even in case application does not
> care to reuse PreparedStatements:
> http://stackoverflow.com/questions/32297503/whats-the-life-span-of-a-postgresql-server-side-prepared...
Thanks
>
for explanation.
That is what I was looking for.
I looked at change log and did not find this.
>> then I simplified code that now is even more portable (as we work
>> with other databases)
>
> Can you share the code?
My statement "more portable" was joke :-)
Idea to get number of milliseconds from database was terrible,
and it was simply mistake.
We love PostgreSQL, but for such thing Java and
System.currentTimeMillis() is much better.
This code was used to profile some piece of code.
It was very bad idea and ugly code, but it was the only
query I was able to find that show toString() format change.
And such format change was very mysterious for me.
Thanks for your help!
--
Regards,
Michał Niklas
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
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: michal.niklas@heuthes.pl
Subject: Re: Change of format of returned flat value after prepareThreshold
In-Reply-To: <5620DB8A.60604@heuthes.pl>
References: <561F9990.10702@heuthes.pl> <CAB=Je-H_Q0ezjcBM9gCta=wVZyUKs+7WExwKRuJRdhssq9B8Bg@mail.gmail.com> <56208B5C.9090803@heuthes.pl> <CAB=Je-F5k+wDDU3V4YE+pSyVK7rDOMmucoQy8wnPK7gFEJeh1g@mail.gmail.com> <5620DB8A.60604@heuthes.pl>
* 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