-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Update query planner statistics of database after library scan finished #4199
Update query planner statistics of database after library scan finished #4199
Conversation
Pull Request Test Coverage Report for Build 1133670393
💛 - Coveralls |
tools/mixxxdb_cleanup.sql
Outdated
VACUUM; | ||
-- Update statistics for the query planner | ||
-- https://www.sqlite.org/lang_analyze.html | ||
ANALYZE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the rational for Analyze before Vacuum? I would swap it intuitively.
Can you add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know which order is correct and why to choose one over the other:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found it:
https://sqlite.org/forum/forumpost/62fb63a29c5f7810?t=h
Richard Hipp himself recommends to run VACCUM before ANALYZE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
This operation turned out to be crucial for achieving an acceptable performance after a mass import into aoide. Otherwise some queries took 30-90s on a large library or just stalled at 100% CPU! Though the issue might not affect Mixxx which uses a simpler schema that requires less JOINs.
The operation typically finishes after ~5-10 sec.