吾爱尚玩资源基地

标题: 清理长期没有登录的游戏账号数据的方法 [打印本页]

作者: admin    时间: 2016-4-20 23:11
标题: 清理长期没有登录的游戏账号数据的方法
运行久了以后。。很多账号长时间没有登录,导致大量数据冗余。需要清理一下。以下是清理方法:


DELETE FROM `realmd`.`account` WHERE `last_login` < '2009-07-31 00:00:00';delete from `realmd`.`realmcharacters` where `acctid` not in (select `id` from `realmd`.`account`);
DELETE FROM `characters`.`characters` WHERE `account` NOT IN (SELECT `id` FROM `realmd`.`account`);
delete from `characters`.`account_data` where `account` not in (SELECT `id` FROM `realmd`.`account`);
delete from `characters`.`arena_team` where `captainguid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`arena_team_member` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`) and `arenateamid` not in (select `characters`.`arena_team`.`arenateamid` from `characters`.`arena_team`);
delete from `characters`.`arena_team_stats` where `arenateamid` not in (select `characters`.`arena_team`.`arenateamid` from `characters`.`arena_team`);
delete from `characters`.`character_account_data` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_achievement` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_achievement_progress` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_action` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_aura` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_equipmentsets` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_homebind` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_inventory` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_pet` where `owner` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_queststatus` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_reputation` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_skills` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_social` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_spell` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_spell_cooldown` where `guid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`character_tutorial` where `account` not in (select `realmd`.`account`.`id` from `realmd`.`account`);
delete from `characters`.`cheaters` where `acctid` not in (select `realmd`.`account`.`id` from `realmd`.`account`);
delete from `characters`.`group_member` where `leaderguid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`) and `memberguid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`groups` where `leaderguid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`guild` where `leaderguid` not in (select `characters`.`characters`.`guid` from `characters`.`characters`);
delete from `characters`.`guild_bank_eventlog` where `guildid` not in (select `characters`.`guild`.`guildid` from `characters`.`guild`);
delete from `characters`.`guild_bank_item` where `guildid` not in (select `characters`.`guild`.`guildid` from `characters`.`guild`);
delete from `characters`.`guild_bank_right` where `guildid` not in (select `characters`.`guild`.`guildid` from `characters`.`guild`);
delete from `characters`.`guild_bank_tab` where `guildid` not in (select `characters`.`guild`.`guildid` from `characters`.`guild`);
delete from `characters`.`guild_eventlog` where `guildid` not in (select `characters`.`guild`.`guildid` from `characters`.`guild`);
delete from `characters`.`guild_member` where `guildid` not in (select `characters`.`guild`.`guildid` from `characters`.`guild`);
delete from `characters`.`guild_rank` where `guildid` not in (select `characters`.`guild`.`guildid` from `characters`.`guild`);






欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/) Powered by Discuz! X3.4