pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] PR #3641: feat: use PreparedStatement for DatabaseMetaData.getCrossReference, getImportedKeys, getExportedKeys
Date: Wed, 28 May 2025 16:03:49 +0000
Message-ID: <[email protected]> (raw)
See https://github.com/pgjdbc/pgjdbc/issues/3511
At best, we should avoid building the same query again and again, however, let's start with just using `PreparedStatements`.
Benchmarks with PG 16.3
Note: `ps.closeOnCompletion()` enables server-prepared statements even though the prepared statements are never closed explicitly (the APIs return `ResultSet`, and there's no way to close the statement other than `closeOnCompletion`).
## Before
```
Benchmark Mode Cnt Score Error Units
DatabaseMetadataBenchmark.getColumns_all avgt 15 1,156 ± 0,184 ms/op
DatabaseMetadataBenchmark.getColumns_named avgt 15 1,085 ± 0,079 ms/op
DatabaseMetadataBenchmark.getCrossReferences avgt 15 42,108 ± 0,536 ms/op
DatabaseMetadataBenchmark.getTables avgt 15 0,423 ± 0,018 ms/op
```
## After: `String` -> `StringBuilder`
```
Benchmark Mode Cnt Score Error Units
DatabaseMetadataBenchmark.getColumns_all avgt 15 0,794 ± 0,041 ms/op
DatabaseMetadataBenchmark.getColumns_named avgt 15 0,820 ± 0,056 ms/op
DatabaseMetadataBenchmark.getCrossReferences avgt 15 4,128 ± 0,156 ms/op
DatabaseMetadataBenchmark.getTables avgt 15 0,489 ± 0,041 ms/op
```
## After: `String` -> `StringBuilder`; `closeOnCompletion`
```
Benchmark Mode Cnt Score Error Units
DatabaseMetadataBenchmark.getColumns_all avgt 15 0,774 ± 0,020 ms/op
DatabaseMetadataBenchmark.getColumns_named avgt 15 0,797 ± 0,034 ms/op
DatabaseMetadataBenchmark.getCrossReferences avgt 15 0,142 ± 0,007 ms/op
DatabaseMetadataBenchmark.getTables avgt 15 0,316 ± 0,050 ms/op
```
view thread (3+ 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] PR #3641: feat: use PreparedStatement for DatabaseMetaData.getCrossReference, getImportedKeys, getExportedKeys
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