After Postgresql database restore automatically run analyze
Problem to solve
Not running ANALYZE after restoring the Postgresql database via the rake task.
Target audience
- Sidney, Systems Administrator, https://design.gitlab.com/research/personas#persona-sidney
Further details
After restoring the database, run ANALYZE to provide the SQL engine with the data it needs from the very beginning to choose how best to access the data.
Proposal
Update sudo gitlab-rake gitlab:backup:restore to also run ANALYZE on the database after a successful restore.
Documentation
A note in backup-restore.md would be added to inform that an ANALYZE will be done as part of the restore process.
What does success look like, and how can we measure that?
Faster use the best SQL plan for accessing data. Restore a database with a large database, run a first SQL query and note the explain plan. Redo the restore with analyze having been done, re-do the query and compare.