pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
the same time value return different values,is it a problem
5+ messages / 3 participants
[nested] [flat]

* the same time value return different values,is it a problem
@ 2023-09-13 07:24  姜梦洋 <minesunny@icloud.com>
  0 siblings, 2 replies; 5+ messages in thread

From: 姜梦洋 @ 2023-09-13 07:24 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

	I find the time type accuracy of the database. Using PreparedStatement, the accuracy found out for the sixth time is different from the first five times. This number is exactly the same as the threshold of the PreparedStatement. I can understand that the database can optimize PreparedStatements and reduce repeated parsing and other unnecessary operations. but I don’t quite understand how such processing will affect the execution results(Or maybe I don’t have a deep understanding of PreparedStatement.). now I run the code and get some results;
=

Attachments:

1.jpeg (image/jpeg, 16.1K) download view image
2.jpeg (image/jpeg, 16.4K) download view image
3.jpeg (image/jpeg, 15.8K) download view image
4.jpeg (image/jpeg, 15.5K) download view image
5.jpeg (image/jpeg, 12.5K) download view image
^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: the same time value return different values,is it a problem
@ 2023-09-13 08:11  姜梦洋 <minesunny@icloud.com>
  parent: 姜梦洋 <minesunny@icloud.com>
  1 sibling, 0 replies; 5+ messages in thread

From: 姜梦洋 @ 2023-09-13 08:11 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

sorry for images,here are clear;


> On Sep 13, 2023, at 3:24 PM, 姜梦洋 <minesunny@icloud.com> wrote:
> 
> 	I find the time type accuracy of the database. Using PreparedStatement, the accuracy found out for the sixth time is different from the first five times. This number is exactly the same as the threshold of the PreparedStatement. I can understand that the database can optimize PreparedStatements and reduce repeated parsing and other unnecessary operations. but I don’t quite understand how such processing will affect the execution results(Or maybe I don’t have a deep understanding of PreparedStatement.). now I run the code and get some results;
> <1.jpeg><2.jpeg><3.jpeg><4.jpeg><5.jpeg>

Attachments:

  Archive.zip (application/zip, 632.1K) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: the same time value return different values,is it a problem
@ 2023-09-13 14:17  Tom Lane <tgl@sss.pgh.pa.us>
  parent: 姜梦洋 <minesunny@icloud.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Tom Lane @ 2023-09-13 14:17 UTC (permalink / raw)
  To: 姜梦洋 <minesunny@icloud.com>; +Cc: pgsql-bugs@lists.postgresql.org

=?utf-8?B?5aec5qKm5rSL?= <minesunny@icloud.com> writes:
> 	I find the time type accuracy of the database. Using PreparedStatement, the accuracy found out for the sixth time is different from the first five times. This number is exactly the same as the threshold of the PreparedStatement. I can understand that the database can optimize PreparedStatements and reduce repeated parsing and other unnecessary operations. but I don’t quite understand how such processing will affect the execution results(Or maybe I don’t have a deep understanding of PreparedStatement.).

If you're using JDBC, this is probably the same effect discussed at

https://www.postgresql.org/message-id/flat/CAKyg5Sj%3D85niw8%3DZhX-quHaCQTPhG40REi1s%2BHYF6Snz4Dfi7Q...

It's got something to do with retrieving the query results in binary
mode instead of text.  The query result at the server is the same,
but the JDBC driver is rendering it differently.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

*  Re: the same time value return different values,is it a problem
@ 2023-09-15 16:58  Dave Cramer <davecramer@postgres.rocks>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Dave Cramer @ 2023-09-15 16:58 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: 姜梦洋 <minesunny@icloud.com>; pgsql-bugs@lists.postgresql.org

On Wed, 13 Sept 2023 at 10:17, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> =?utf-8?B?5aec5qKm5rSL?= <minesunny@icloud.com> writes:
> >       I find the time type accuracy of the database. Using
> PreparedStatement, the accuracy found out for the sixth time is different
> from the first five times. This number is exactly the same as the threshold
> of the PreparedStatement. I can understand that the database can optimize
> PreparedStatements and reduce repeated parsing and other unnecessary
> operations. but I don’t quite understand how such processing will affect
> the execution results(Or maybe I don’t have a deep understanding of
> PreparedStatement.).
>

What is the difference and the type of the column? I'm not about to open a
zip file.



>
> If you're using JDBC, this is probably the same effect discussed at
>
>
> https://www.postgresql.org/message-id/flat/CAKyg5Sj%3D85niw8%3DZhX-quHaCQTPhG40REi1s%2BHYF6Snz4Dfi7Q...
>
> It's got something to do with retrieving the query results in binary
> mode instead of text.  The query result at the server is the same,
> but the JDBC driver is rendering it differently.
>
>
rendering is not quite right. The parsing tends to be slightly different in
text vs binary.


Dave Cramer
www.postgres.rocks

                        regards, tom lane
>
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

*  Re: the same time value return different values,is it a problem
@ 2023-09-17 11:33  Dave Cramer <davecramer@postgres.rocks>
  parent: Dave Cramer <davecramer@postgres.rocks>
  0 siblings, 0 replies; 5+ messages in thread

From: Dave Cramer @ 2023-09-17 11:33 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: 姜梦洋 <minesunny@icloud.com>; pgsql-bugs@lists.postgresql.org

On Fri, 15 Sept 2023 at 12:58, Dave Cramer <davecramer@postgres.rocks>
wrote:

>
>
> On Wed, 13 Sept 2023 at 10:17, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> =?utf-8?B?5aec5qKm5rSL?= <minesunny@icloud.com> writes:
>> >       I find the time type accuracy of the database. Using
>> PreparedStatement, the accuracy found out for the sixth time is different
>> from the first five times. This number is exactly the same as the threshold
>> of the PreparedStatement. I can understand that the database can optimize
>> PreparedStatements and reduce repeated parsing and other unnecessary
>> operations. but I don’t quite understand how such processing will affect
>> the execution results(Or maybe I don’t have a deep understanding of
>> PreparedStatement.).
>>
>
> What is the difference and the type of the column? I'm not about to open a
> zip file.
>
>
>
>>
>> If you're using JDBC, this is probably the same effect discussed at
>>
>>
>> https://www.postgresql.org/message-id/flat/CAKyg5Sj%3D85niw8%3DZhX-quHaCQTPhG40REi1s%2BHYF6Snz4Dfi7Q...
>>
>> It's got something to do with retrieving the query results in binary
>> mode instead of text.  The query result at the server is the same,
>> but the JDBC driver is rendering it differently.
>>
>>
> rendering is not quite right. The parsing tends to be slightly different
> in text vs binary.
>

So it is interesting that we drop the precision of time when we receive the
data in binary. I'll have a look when I have time.

Dave

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-09-17 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 07:24 the same time value return different values,is it a problem 姜梦洋 <minesunny@icloud.com>
2023-09-13 08:11 ` 姜梦洋 <minesunny@icloud.com>
2023-09-13 14:17 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-09-15 16:58   ` Dave Cramer <davecramer@postgres.rocks>
2023-09-17 11:33     ` Dave Cramer <davecramer@postgres.rocks>

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