Skip to content

Instantly share code, notes, and snippets.

@bhaskar-f22
bhaskar-f22 / Reclaim_mysql_space.sql
Created July 15, 2021 08:06
Reclam unused space from DB
-- First opthimize the table where you want to claim space
opthimize table <table-name>;
-- Delete logs except latest log file
show binary logs;
PURGE BINARY LOGS TO 'mysql-bin.006920';
@bhaskar-f22
bhaskar-f22 / remove_sidekiq_job.rb
Last active July 19, 2021 14:28
This script is useful to kill running sidekiq jobs with particular class name
queue = Sidekiq::Queue.new("practice_fusion")
queue.each do |job|
job.delete if job.klass == 'PracticeFusionWorkers::PatientDocumentsSyncer'
end
# Way 2
ss = Sidekiq::ScheduledSet.new
jobs = ss.select {|job| job.klass == 'PracticeFusionWorkers::PatientDocumentsSyncer' }
jobs.each(&:delete)