pgjdbc/pgjdbc GitHub issues and pull requests (mirror)help / color / mirror / Atom feed
[pgjdbc/pgjdbc] PR #3641: feat: use PreparedStatement for DatabaseMetaData.getCrossReference, getImportedKeys, getExportedKeys 3+ messages / 2 participants [nested] [flat]
* [pgjdbc/pgjdbc] PR #3641: feat: use PreparedStatement for DatabaseMetaData.getCrossReference, getImportedKeys, getExportedKeys @ 2025-05-28 16:03 "vlsi (@vlsi)" <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: vlsi (@vlsi) @ 2025-05-28 16:03 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> 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 ``` ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #3641: feat: use PreparedStatement for DatabaseMetaData.getCrossReference, getImportedKeys, getExportedKeys @ 2025-05-28 16:34 ` "davecramer (@davecramer)" <[email protected]> 1 sibling, 0 replies; 3+ messages in thread From: davecramer (@davecramer) @ 2025-05-28 16:34 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> Fair, but I think we need to understand the root cause of the regression. ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #3641: feat: use PreparedStatement for DatabaseMetaData.getCrossReference, getImportedKeys, getExportedKeys @ 2025-05-30 16:54 ` "vlsi (@vlsi)" <[email protected]> 1 sibling, 0 replies; 3+ messages in thread From: vlsi (@vlsi) @ 2025-05-30 16:54 UTC (permalink / raw) To: pgjdbc/pgjdbc <[email protected]> Any thoughts? I think we could merge this and release yet another version to get the perf issue fixed. The core changes here are like `String->StringBuilder`. It would be great to add `try-with-resources`, however I don't like to mix many changes into a single PR. ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-05-30 16:54 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-05-28 16:03 [pgjdbc/pgjdbc] PR #3641: feat: use PreparedStatement for DatabaseMetaData.getCrossReference, getImportedKeys, getExportedKeys "vlsi (@vlsi)" <[email protected]> 2025-05-28 16:34 ` "davecramer (@davecramer)" <[email protected]> 2025-05-30 16:54 ` "vlsi (@vlsi)" <[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