diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2011-07-13 12:32:35 +0200 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2011-07-13 12:32:35 +0200 |
commit | 958befb4f7eef5aa85a0721f908786d351840e04 (patch) | |
tree | c41f6b9e62c886e4a659e93f0b8647947b3ff818 /DataBase/remove-badges-variants.mysql | |
parent | f1c8fca45d9948b91f18d1dca20068143d0e6742 (diff) |
[DataBase] better cleanup scripts, very much faster, less CPU usage
Diffstat (limited to 'DataBase/remove-badges-variants.mysql')
-rw-r--r-- | DataBase/remove-badges-variants.mysql | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/DataBase/remove-badges-variants.mysql b/DataBase/remove-badges-variants.mysql deleted file mode 100644 index 3f29d2a..0000000 --- a/DataBase/remove-badges-variants.mysql +++ /dev/null @@ -1,32 +0,0 @@ - -USE lastfm - - -/** - * Deletes all entries in badges - * for each unique username + type - * where more than one style or color exists - */ - -DROP TABLE IF EXISTS tmp ; -CREATE TEMPORARY TABLE tmp (SELECT username, type, COUNT(username) AS count FROM badges GROUP BY username, type ) ; - -SELECT badges.png - FROM badges, tmp - WHERE badges.username = tmp.username - AND ( (badges.type = tmp.type AND tmp.count > 1) - OR ( (badges.type LIKE concat(tmp.type,"%") OR tmp.type LIKE concat(badges.type,"%")) - AND badges.type != tmp.type ) - ) ; - -DELETE badges.* - FROM badges, tmp - WHERE badges.username = tmp.username - AND ( (badges.type = tmp.type AND tmp.count > 1) - OR ( (badges.type LIKE concat(tmp.type,"%") OR tmp.type LIKE concat(badges.type,"%")) - AND badges.type != tmp.type ) - ) ; - - -DROP TABLE tmp ; - |