Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Tue, 30 Sep 2025 18:03:46 +0000 Subject: [pgjdbc/pgjdbc] PR #3836: fix: improve concurrency for prepareStatement List-Id: X-GitHub-Author-Id: 213894 X-GitHub-Author-Login: vlsi X-GitHub-Issue: 3836 X-GitHub-Labels: performance X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: open X-GitHub-Type: pull_request X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3836 Content-Type: text/plain; charset=utf-8 Previously, prepareStatement synchronized on a per-connection statement cache for parsing the statement. Technically speaking, it is not the best idea to share the same connections across several execution threads, however, the driver does not need to heavily synchronize when parsing the SQL. Issue 3835 shows a case it might result in a carrier thread pinning, so it still makes sense to move .create() outside of the synchronization. The impact/improvement on the applications should be minimal provided the application do not share a connection across concurrent execution threads. Fixes https://github.com/pgjdbc/pgjdbc/issues/3835