Skip to content

Instantly share code, notes, and snippets.

@bastengao
Last active May 17, 2019 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastengao/092b0e2e1562fa6e9f68fe07c5af7c7e to your computer and use it in GitHub Desktop.
Save bastengao/092b0e2e1562fa6e9f68fe07c5af7c7e to your computer and use it in GitHub Desktop.
Execute vacuum analyze for all tables
ActiveRecord::Base.connection.tables.each { |name| puts "VACUUM ANALYZE #{name}"; ActiveRecord::Base.connection.execute("VACUUM ANALYZE #{name};") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment