pgjdbc/pgjdbc GitHub issues and pull requests (mirror)help / color / mirror / Atom feed
[pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB 8+ messages / 3 participants [nested] [flat]
* [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB @ 2025-07-13 14:32 "wufengke (@wufengke)" <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: wufengke (@wufengke) @ 2025-07-13 14:32 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> version: 42.7.4 When I use the executeBatch() for a bulk(infact it's small) data insert and want return the generatedKeys, I find when the batch size is more than 50, it will sometimes block in the DB and does not return any more. I can not find the root cause. This issue still exists in the newest version. The key point I think it related to the retrunGeneratedKeys, more keys returned and more chance it will happen. If it is a known issure, what is the best practise to workaround if I want to get the serial generated keys when insert data? Insert without result key and find them by a batch query after insert is a best way? ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB @ 2025-07-13 15:44 ` "davecramer (@davecramer)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: davecramer (@davecramer) @ 2025-07-13 15:44 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> I suspect this is a duplicate of https://github.com/pgjdbc/pgjdbc/issues/194 ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB @ 2025-07-13 16:04 ` "wufengke (@wufengke)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: wufengke (@wufengke) @ 2025-07-13 16:04 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> If it is a known issure, what is the best practise to workaround if I want to get the serial generated keys when insert data? Insert without result key and find them by a batch query after insert is a best way? ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB @ 2025-07-13 17:24 ` "davecramer (@davecramer)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: davecramer (@davecramer) @ 2025-07-13 17:24 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> Use smaller batches ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB @ 2025-07-14 13:41 ` "wufengke (@wufengke)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: wufengke (@wufengke) @ 2025-07-14 13:41 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> Thanks. But I have another question, does the batchExecute() realy in a batch way? Because I find it's performance is almost the same as application layer loop. I have 5 thousand data. ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB @ 2025-07-14 13:49 ` "davecramer (@davecramer)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: davecramer (@davecramer) @ 2025-07-14 13:49 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> There is no concept of executeBatch in postgres. You can try [`rewriteBatchInserts`](https://github.com/pgjdbc/pgjdbc/blob/7b1984b25590171906c96687bc99d7aeaa7a8000/README.md?plain=1#L14...) to see if that will help ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB @ 2026-04-08 04:47 ` "bilalshehata (@bilalshehata)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: bilalshehata (@bilalshehata) @ 2026-04-08 04:47 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> Hi @davecramer , https://github.com/pgjdbc/pgjdbc/pull/4013 what do you think of this as a potential fix? ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB @ 2026-04-08 09:09 ` "davecramer (@davecramer)" <[email protected]> 6 siblings, 0 replies; 8+ messages in thread From: davecramer (@davecramer) @ 2026-04-08 09:09 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> @bilalshehata certainly can't hurt. Let's see if it passes all the tests ^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2026-04-08 09:09 UTC | newest] Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-07-13 14:32 [pgjdbc/pgjdbc] issue #3726: BatchInsert + generatedKeys will cause insert block in DB "wufengke (@wufengke)" <[email protected]> 2025-07-13 15:44 ` "davecramer (@davecramer)" <[email protected]> 2025-07-13 16:04 ` "wufengke (@wufengke)" <[email protected]> 2025-07-13 17:24 ` "davecramer (@davecramer)" <[email protected]> 2025-07-14 13:41 ` "wufengke (@wufengke)" <[email protected]> 2025-07-14 13:49 ` "davecramer (@davecramer)" <[email protected]> 2026-04-08 04:47 ` "bilalshehata (@bilalshehata)" <[email protected]> 2026-04-08 09:09 ` "davecramer (@davecramer)" <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox