Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Support optimization for postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
swoopla authored and ZeroPointEnergy committed Sep 11, 2018
1 parent 89df6d6 commit 838062e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/tasks/db_raw.rake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ namespace :db do
puts "* #{table}"
ActiveRecord::Base.connection.execute("OPTIMIZE TABLE #{table}")
end
when 'postgresql'
puts "Optimizing tables, this may take a while:"
for table in ActiveRecord::Base.connection.tables.sort
puts "* #{table}"
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table}")
end
else
raise "Don't know how to optimize for database engine: #{adapter}"
end
Expand Down

0 comments on commit 838062e

Please sign in to comment.