Repository navigation
perf: group INSERT split tuples by shard - #1864
Merged
Merged
Conversation
jkaczman
added this pull request to stack #1863
October 20, 2026 20:44
jkaczman
force-pushed
the
jk-insert-split-by-shard
branch
from
October 21, 2026 01:56
d67b1a3 to
8b9cb46
Compare
jkaczman
force-pushed
the
jk-insert-split-by-shard
branch
from
October 21, 2026 03:57
8b9cb46 to
141368c
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
|
| Project | PgDog |
| Branch | jk-insert-split-by-shard |
| Testbed | Intel v1 |
🐰 View full continuous benchmarking report in Bencher
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
Contributor
|
| Project | PgDog |
| Branch | jk-insert-split-by-shard |
| Testbed | Intel v1 |
Click to view all benchmark results
| Benchmark | Throughput | Benchmark Result operations / second (ops/s) x 1e3 (Result Δ%) | Lower Boundary operations / second (ops/s) x 1e3 (Limit %) | cpu-per-txn | Benchmark Result Measure (units) (Result Δ%) | Upper Boundary Measure (units) (Limit %) |
|---|---|---|---|---|---|---|
| pooler-v2 | 📈 view plot 🚷 view threshold | 29.21 ops/s x 1e3(-0.36%)Baseline: 29.31 ops/s x 1e3 | 29.02 ops/s x 1e3 (99.36%) | 📈 view plot 🚷 view threshold | 34.25 units(+0.36%)Baseline: 34.13 units | 34.47 units (99.37%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If we have a query we're re-writing for INSERT split that has multiple tuples that resolve to the same shard, this now groups those into a singular query, as opposed to the previous code always splitting each individual tuple into its own statement. This should produce massive speedup for large splits.
Motivated by subqueries, where we'll have cases like
INSERT INTO .. SELECT FROM generate_series(..), which will be passed through here and involve massive amount of data.Future work here will be figuring out how to handle those massive cases further, e.g., we'll need to impose a per-query limit of how much we batch depending on Postgres's limits (w.r.t bind parameters and query sizes). Also, need to figure out a good way to pass the evaluated subquery data rows and row description into the Query Engine without re-writing the top-level statement when we have an INSERT split, so that we don't have to put together unnecessary intermediate string(s), which will just be re-written again to be split apart by INSERT split.
Fixes #1818.