Merged
Conversation
simolus3
previously approved these changes
May 27, 2025
Contributor
simolus3
left a comment
There was a problem hiding this comment.
Looks good to me 👍 I agree that we don't have to worry about enforcing table order here.
bd2acf0 to
42e3da1
Compare
simolus3
approved these changes
May 28, 2025
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.
This keeps prepared statements around for the last table, to avoid preparing a new statement for every row that we insert/delete.
I did not fully confirm, but I expect that the way the query plan is structured that the rows would typically be processed one table at a time, making it efficient to only keep the tables for the last query. It is not an issue if the order is different - we may just lose a little of the performance benefits here.
In my tests on native desktop with an in-memory db, this reduced the overall sync_local duration by around 25% (2786ms -> 2075ms for 500k rows). When taking into account filesystem overhead, the impact will be a little less, but still significant.