Skip to content

Conversation

@gorbak25
Copy link
Contributor

@gorbak25 gorbak25 commented Oct 24, 2025

This PR uses #383 for efficient bulk operations on the crsql_changes, __corro_buffered_changes, __corro_members and bookie tables. To make writing array queries easier I've added the unnest_param which allows to use unnest in queries without too much boilerplate.

I've benchmarked the effect unnest had on full changes:
image
Previously in #377 (WARNING: The baseline chart has the red line on 50, now we use 100) the throughput values were platoing at 50k changes/s. With unnest that value went up to 70k changes/s with no plato in sight(probably perf will increase for even higher batch sizes). For the batch size we use perf went up slightly.

Larger changes with regards to buffered changes will be done in an separate PR.

@gorbak25 gorbak25 force-pushed the gorbak/process_changes_opt branch 3 times, most recently from 695b182 to 07bde81 Compare November 3, 2025 14:26
@gorbak25 gorbak25 requested a review from somtochiama November 3, 2025 14:31
@gorbak25 gorbak25 marked this pull request as ready for review November 3, 2025 14:31
@gorbak25 gorbak25 force-pushed the gorbak/process_changes_opt branch from 07bde81 to 825559b Compare November 3, 2025 14:33
Copy link
Contributor

@somtochiama somtochiama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

last_rowids[i].2 = last_rowids[i + 1].2;
}
last_rowids[last_rowids_len - 1].2 = sp
.prepare_cached("SELECT last_insert_rowid()")?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice workaround with last_insert_row_id !

@gorbak25 gorbak25 merged commit 8fd00b8 into main Nov 4, 2025
7 checks passed
@gorbak25 gorbak25 deleted the gorbak/process_changes_opt branch November 4, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants