Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Boris BorisBresciani

🎯
Focusing
  • Paris
Block or report user

Report or block BorisBresciani

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@BorisBresciani
BorisBresciani / optimization.rake
Created Jun 26, 2019 — forked from merqlove/optimization.rake
PostgreSQL optimization tasks for ActiveRecord
View optimization.rake
namespace :optimization do
desc "Provide DB vacuum for production environment"
task :vacuum => :environment do
begin
tables = ActiveRecord::Base.connection.tables
tables.each do |table|
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};")
end
rescue Exception => exc
Rails.logger.error("Database VACUUM error: #{exc.message}")
You can’t perform that action at this time.