Skip to content

Optimised copy full batches#12

Open
koszti wants to merge 2 commits intocubedevinc:masterfrom
koszti:optimised-copy-full-batches
Open

Optimised copy full batches#12
koszti wants to merge 2 commits intocubedevinc:masterfrom
koszti:optimised-copy-full-batches

Conversation

@koszti
Copy link

@koszti koszti commented Oct 16, 2018

Replicating from Binary-Log with incoming UPDATES (hence multiple versions of the row with the same PK) calls intermediate flush_records to avoid issues with upserts.

This method works fine but if the replication BinLog has a lot of updates then it produces a lot of unnecessary COPY/INSERT/UPDATE commands with small number of rows which is not efficient.

This PR keeps the incoming rows in python dictionaries where dict key is the Primary Key of the rows. If a new version of the row arrives then it will update the values in the python dictionary without hitting the database. flush_records will be called only when the batch is full and in the last loop.

@airhorns
Copy link

👍 this would be great to get in!

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.

2 participants