-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[extension/dbstorage] Optimize Batch performance for single-type Operations set #38026
[extension/dbstorage] Optimize Batch performance for single-type Operations set #38026
Conversation
95f6d80
to
5b4fd9a
Compare
Also, in context of future |
Is the benchmark test in main? Can you run before/after and compare with benchstat? |
That's a new benchmarks, not currently present in main
As you can see there are only few cases with performance degradation, but all other case has impressive performance improvements alongside with much lower resource utilization |
alright, that's impressive. |
Something I'm a bit concerned about is that, while the benchmark results are very impressive, they show a performance regression in what I believe to be the most common case for this extension: a single GET operation.
Why does this regression happen? Intuitively, I'd expect no change. |
Actually, this regression has quite simple explanation: |
Description
After examine of
storage.Batch()
usage in Persistent Queue, I've found that in several cases when this API is used with set of operations that has same type. For example here, here, here and hereAt the moment such
storage.Batch()
calls will generate number of SQL queries (SELECT/INSERT/DELETE), one for each Operation. But this behavior can be improved by issuing a single query with proper set of arguments taken from all provided Operations.This PR is adding such optimization, as well as set of new Unit Tests for the new functionality and set of Benchmarks of course
Testing
Respective unit tests were added for the new functions.
Also integration tests were updated to include this optimization tests.
Result of Benchmarks for both cases - without optimization (
MultiQuery
) and with optimization (SingleQuery
) for all currently supported SQL Drivers (sqlite3
,pgx
):