pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: dreis2211 (@dreis2211) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3894: Performance regression caused by keeping QUERY_EXECUTE_AS_SIMPLE flag
Date: Tue, 16 Dec 2025 16:18:48 +0000
Message-ID: <[email protected]> (raw)

Hi,

I found that after upgrading a Spring-Boot project the particular test suite and certain specific database heavy tests were 2-4 times slower than before. Running a single of those DB heavy tests via Gradle yields this:

**Before**
```
BUILD SUCCESSFUL in 3m 38s
```

**After**
```
BUILD SUCCESSFUL in 12m 57s
```

I could trace this back to an update from the postgresql driver from version [42.7.6](https://github.com/pgjdbc/pgjdbc/releases/tag/REL42.7.6) to [42.7.7](https://github.com/pgjdbc/pgjdbc/releases/tag/REL42.7.7).

As there are not many changes that could be responsible I looked at the following:

- https://github.com/pgjdbc/pgjdbc/commit/cb10dce086845b300f67125a7f33d59cc824c3d8

Particularly, the removal of the following case block
```
      case EXTENDED:
        return flags & ~QUERY_EXECUTE_AS_SIMPLE;
```

When reintroducing this and building a local snapshot, the tests run fast again. I'm not deep enough into the pgjdbc driver to make any call of why that is, but it has a relatively severe impact on us. Briefly looking into things, I wonder if more things than wanted reach "QueryExecutorImpl::sendSimpleQuery" now. At least logging reveals more activity there
```
....
 FE=> SimpleQuery(query="SET application_name = 'PostgreSQL JDBC Driver'")
 FE=> SimpleQuery(query="")
 FE=> SimpleQuery(query="BEGIN")
 FE=> SimpleQuery(query="BEGIN")
 FE=> SimpleQuery(query="BEGIN")
 FE=> SimpleQuery(query="BEGIN")
 FE=> SimpleQuery(query="BEGIN")
 FE=> SimpleQuery(query="BEGIN READ ONLY")
 FE=> SimpleQuery(query="BEGIN")
.....
```

Basically every `BEGIN` (and that's in the thousands) etc. ends up there now, which seems to regress performance. But maybe it's also a completely different place that is impacted by keeping the QUERY_EXECUTE_AS_SIMPLE flag and thus reducing performance.

Unfortunately, I can't share the project at hand, but I hope you have enough information to investigate things. Let me know if I can help in any way.

Cheers,
Christoph


view thread (7+ 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 #3894: Performance regression caused by keeping QUERY_EXECUTE_AS_SIMPLE flag
  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