Skip to content

Instantly share code, notes, and snippets.

@thmsobrmlr
Created August 23, 2013 11:46
Show Gist options
  • Save thmsobrmlr/6318456 to your computer and use it in GitHub Desktop.
Save thmsobrmlr/6318456 to your computer and use it in GitHub Desktop.
Delete duplicate entries in a table (fast)
create table tmp like mytable;
alter table tmp engine=MyISAM;
insert into tmp select * from mytable;
alter ignore table tmp add unique index(col1,col2);
alter table tmp engine=InnoDB;
rename table mytable to deleteme, tmp to mytable;
drop table deleteme;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment