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

Add batched SQL for insert/update operations #306

Merged
merged 1 commit into from Aug 29, 2022

Conversation

simonprev
Copy link
Member

This introduce a new way of doing "migration" of data based on the
operation table. Before, we simply executed the SQL query as the
migration were run. Like for a "new" operation, we did an insert of a
"transactions" row and an update to the "operations" table for each
entry in the synced file.
For a file containing 1000 keys, we did a
total of 2000 SQL queries.

After this commit, we only do 2 SQL queries (well 4 since we batch the
SQL params by 500). By aggregating operation like {:update_all,
operation.id, %{synced: true}}, we are able to batch the operations
efficiently.

This results in a much faster sync/add translations/correct/uncorrect
operations.

(I also snuck in a global API token fix)

This introduce a new way of doing "migration" of data based on the
operation table. Before, we simply executed the SQL query as the
migration were run. Like for a "new" operation, we did an insert of a
"transactions" row and an update to the "operations" table _for each
entry in the synced file._ For a file containing 1000 keys, we did a
total of 2000 SQL queries.

After this commit, we only do 2 SQL queries (well 4 since we batch the
SQL params by 500). By aggregating operation like {:update_all,
operation.id, %{synced: true}}, we are able to batch the operations
efficiently.

This results in a much faster sync/add translations/correct/uncorrect
operations.
@simonprev simonprev force-pushed the feature/batched-sql-operations branch from 78528d4 to f4bad30 Compare August 29, 2022 00:24
@simonprev simonprev merged commit 3325e5e into master Aug 29, 2022
@simonprev simonprev deleted the feature/batched-sql-operations branch August 29, 2022 11: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.

None yet

1 participant