pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #3811: PreparedStatement batch performance issue in a loop on v42.7.6 or later
Date: Sat, 20 Sep 2025 06:25:07 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

@leandrokemp , Previously, `ps.toString();` rendered only the the last value, and 0a88ea425e86dce691a96d6aa7023c20ac887b98 probably fixed it, so now `ps.toString()` renders all the values in a batch. Now `ps.toString()` properly displays all the values it is about to send to the database, and it is far `toString()` to take longer time as the list of values grows. This makes `ps.toString(); ps.addBatch()` loop behave with O(N^2) properties, thus it effectively hangs.

If you want to log the executed statement, you'd better move the logging out of the loop just before `executeBatch`.

I am leaning towards to closing the issue with "working as expected, won't fix" resolution unless you justify the business case behind calling `ps.toString(); ps.addBatch();` within a loop.

view thread (4+ messages)  latest in thread

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: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #3811: PreparedStatement batch performance issue in a loop on v42.7.6 or later
  In-Reply-To: <<[email protected]>>

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

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