Oct
30th
Thu
30th
Deleting Duplicates with Unique Keys in MySQL with Ruby
Trying to delete duplicate data is a pain. Especially when your table is bigger than your RAM available so you cannot just create a temp table can copy the unique rows back and forth.
So I’ve made available some code in this gist which will delete duplicate data, in the case where the ids are unique but the data is duplicated.
# USE: delete_dups_for(Comment, :post_id)
NB: code is at the bottom, the first 232 lines are the Ruby Progress Bar lib