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

⚡ Optimized performance of integrity check DB calls #265

Merged
merged 1 commit into from
Oct 8, 2021
Merged

Conversation

daniellockyer
Copy link
Member

@daniellockyer daniellockyer commented Oct 4, 2021

refs #252

  • the referenced issue describes performance problems with the integrity check code in knex-migrator
  • this commit solves half of the problem - 1 DB call per migration minor version folder
  • this results in 70+ (and growing!) DB calls at boot, with each one going back and forth to the DB... not efficient
  • what the code actually needed was a count of how many migrations are currently in the DB, group by minor version - this is very easy to do in SQL and therefore knex
  • this commit switches the code around to group all the DB migrations first, and then compares against the folders locally
  • this results in a drop of SQL queries from 70+ to 1 🚀

@daniellockyer daniellockyer changed the title ⚡ Improved performance of the integrity check ⚡ Optimized performance of integrity check DB calls Oct 8, 2021
refs #252

- the referenced issue describes performance problems with the integrity check code in knex-migrator
- this commit solves half of the problem - 1 DB call per migration minor version folder
- this results in 70+ (and growing!) DB calls at boot, with each one going back and forth to the DB... not efficient
- what the code actually needed was a count of how many migrations are currently in the DB, grouped by version - this is very easy to do in SQL and therefore knex
- this commit switches the code around to group all the DB migrations first, and then compares against the folders locally
- this results in a drop of SQL queries from 70+ to 1 🚀
@daniellockyer daniellockyer marked this pull request as ready for review October 8, 2021 13:14
@daniellockyer daniellockyer merged commit 838fe54 into master Oct 8, 2021
@daniellockyer daniellockyer deleted the perf branch October 8, 2021 13:14
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