Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved replay process #163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Improved replay process #163

wants to merge 1 commit into from

Conversation

bukem
Copy link

@bukem bukem commented Jun 15, 2023

This PR contains an optimization of the procedure for applying changes to Postgresql.
The point is that with a large number of changes on the source (mysql) the replay process may not be able to cope with the flow of incoming events. The situation is exacerbated if the frequently changing replicated table consists of a large number of columns, because there is a block in the query which multiplies all columns of the table with a json object containing all columns with data. This can result in hundreds of gigabytes worth of results which Postgresql has to handle (sort, group, apply some functions). Even high work_mem don't make a significant improvement.
The situation gets even worse if the table has a compound primary key.
This fix eliminates the need to multiply the json object by the number of columns in the table and by the number of rows in the primary key.

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.

1 participant