[*] optimize flush() in pg sink - #1537
Merged
Merged
Conversation
We don't have to loop over all the rows in a `Measurements` and read `epoch_ns` from each because typically all of them will contain the same value extracted from `now()` in the same txn.
Coverage Report for CI Build 33176349266Coverage decreased (-0.1%) to 87.878%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions8 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
Collaborator
|
cool! do you have numbers on speed imrovements? |
pashagolub
reviewed
Aug 28, 2026
Co-authored-by: Pavlo Golub <pavlo.golub@gmail.com>
Collaborator
Author
Nope, I didn't benchmark it, but I would expect an improvement only for large setups with 100s of monitored sources, with each of them returning a lot of rows. IMO, smaller setups won't be affected that much. |
Collaborator
Author
I did a small benchmark on my local machine mimicking 1000 sources, each with 80 active metrics with the same interval, and each metric returns 200 rows, and it was 7% faster: |
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.
We don't need to loop over all the rows in
Measurementsand readepoch_nsfrom each, because they typically all contain the same value extracted fromnow()in the same txn.