Skip to content

Instantly share code, notes, and snippets.


Boris BorisBresciani

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 / 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
tables = ActiveRecord::Base.connection.tables
tables.each do |table|
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};")
rescue Exception => exc
Rails.logger.error("Database VACUUM error: #{exc.message}")
You can’t perform that action at this time.