-- --------------从库操作，统计bbs7_user_topic、bbs7_user_post、bbs7_pick表的脏数据,(可以上线后做)----------------------------
-- 1.保存bbs7_user_topic表在物理上的脏数据
	CREATE TABLE user_topic_physic (
		tid INT(10) NOT NULL,
		uid INT(10) NOT NULL,
		KEY idx_user_topic_physic_tid(tid)
	);
	
	CREATE TABLE user_topic_all (
		tid INT(10) NOT NULL,
		uid INT(10) NOT NULL,
		KEY idx_user_topic_all_tid(tid)
	);
	INSERT INTO user_topic_all SELECT tid,uid FROM (
		SELECT tid,uid FROM bbs7_user_topic
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_1
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_2
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_3
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_4
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_5
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_6
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_7
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_8
		UNION ALL
		SELECT tid,uid FROM bbs7_user_topic_9
	) r;
	INSERT INTO user_topic_physic SELECT tid,uid FROM user_topic_all a WHERE NOT EXISTS (SELECT 1 FROM tid_uid_pick b WHERE a.tid = b.tid);
	COMMIT;
-- 2.保存bbs7_user_post表在物理上的脏数据,
	CREATE TABLE user_post_physic (
		pid INT(10) NOT NULL,
		uid INT(10) NOT NULL,
		tid INT(10) NOT NULL,
		key idx_user_post_physicz_pid(pid),
		KEY idx_user_post_physicz_put(pid,uid,tid)
	);
	
	CREATE TABLE user_post_all (
		pid INT(10) NOT NULL,
		uid INT(10) NOT NULL,
		tid INT(10) NOT NULL,
		KEY idx_user_post_all_pid(pid)
	);
	INSERT INTO user_post_all SELECT pid, uid, tid FROM (
		SELECT pid, uid, tid FROM bbs7_user_post
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_1
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_2
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_3
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_4
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_5
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_6
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_7
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_8
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_9
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_10
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_11
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_12
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_13
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_14
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_15
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_16
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_17
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_18
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_19
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_20
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_21
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_22
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_23
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_24
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_25
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_26
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_27
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_28
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_29
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_30
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_31
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_32
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_33
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_34
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_35
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_36
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_37
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_38
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_39
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_40
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_41
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_42
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_43
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_44
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_45
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_46
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_47
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_48
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_49
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_50
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_51
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_52
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_53
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_54
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_55
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_56
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_57
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_58
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_59
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_60
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_61
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_62
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_63
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_64
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_65
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_66
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_67
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_68
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_69
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_70
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_71
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_72
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_73
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_74
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_75
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_76
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_77
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_78
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_79
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_80
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_81
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_82
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_83
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_84
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_85
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_86
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_87
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_88
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_89
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_90
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_91
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_92
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_93
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_94
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_95
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_96
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_97
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_98
		UNION ALL
		SELECT pid, uid, tid FROM bbs7_user_post_99

	) u;
	COMMIT;
	-- 物理上和逻辑上都需删除
	INSERT INTO user_post_physic SELECT pid, uid, tid FROM user_post_all a WHERE NOT EXISTS (SELECT 1 FROM uid_pid_status_seq0 b WHERE a.pid = b.pid);
	COMMIT;
-- 3.保存bbs7_pick表在物理的脏数据
	CREATE TABLE pick_physic (
		tid INT(10) NOT NULL,
		KEY idx_pick_physic_tid(tid)
	);
	
	-- 物理上
	INSERT INTO pick_physic SELECT tid FROM bbs7_pick a WHERE NOT EXISTS (SELECT 1 FROM tid_uid_pick b WHERE a.tid = b.tid);
	COMMIT;
	
	
-- 注意：要同步这三个表到主库上：user_topic_physic、user_post_physic、pick_physic	

----------------------------------- 4.检查各表冗余数据并删除,在主库上操作-----------------------------------------------------------
	-- 删除bbs7_user_topic表的冗余数据
	BEGIN;
	DELETE a FROM bbs7_user_topic a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_1 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_2 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_3 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_4 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_5 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_6 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_7 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_8 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	DELETE a FROM bbs7_user_topic_9 a WHERE EXISTS (SELECT 1 FROM user_topic_physic b WHERE a.tid = b.tid);
	COMMIT;
	-- 删除bbs7_user_post表的冗余数据
	BEGIN;
	DELETE a FROM bbs7_user_post a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_1 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_2 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_3 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_4 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_5 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_6 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_7 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_8 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_9 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_10 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_11 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_12 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_13 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_14 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_15 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_16 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_17 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_18 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_19 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_20 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_21 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_22 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_23 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_24 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_25 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_26 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_27 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_28 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_29 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_30 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_31 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_32 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_33 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_34 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_35 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_36 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_37 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_38 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_39 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_40 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_41 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_42 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_43 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_44 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_45 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_46 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_47 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_48 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_49 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_50 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_51 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_52 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_53 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_54 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_55 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_56 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_57 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_58 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_59 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_60 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_61 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_62 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_63 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_64 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_65 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_66 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_67 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_68 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_69 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_70 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_71 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_72 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_73 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_74 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_75 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_76 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_77 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_78 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_79 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_80 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_81 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_82 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_83 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_84 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_85 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_86 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_87 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_88 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_89 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_90 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_91 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_92 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_93 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_94 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_95 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_96 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_97 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_98 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	DELETE a FROM bbs7_user_post_99 a WHERE EXISTS (SELECT 1 FROM user_post_physic b WHERE a.pid = b.pid);
	COMMIT;
	-- 删除bbs7_pick表的冗余数据
	DELETE a FROM bbs7_pick a WHERE EXISTS (SELECT 1 FROM pick_physic b WHERE a.tid = b.tid);
	COMMIT;
-- --------------------删除临时表(先别删)----------------------------------------------------------- --
	DROP TABLE tid_uid_pick;
	DROP TABLE tid_uid_pick_pickgt0;
	DROP TABLE uid_pid_status_floor;
	DROP TABLE uid_pid_status_seq0;
	DROP TABLE uid_pid_status_fgt1seq0;
	DROP TABLE uid_topiccount;
	DROP TABLE uid_postcount;
	DROP TABLE uid_pickcoount;
	DROP TABLE user_count;
	DROP TABLE user_topic_physic;
	DROP TABLE user_post_physic;
	DROP TABLE pick_physic;
	DROP TABLE user_topic_all;
	DROP TABLE user_post_all;

	COMMIT;
	
	
-- ---------------------------------删除其他冗余数据------------------------------ --

-- 删除用户收藏帖子的冗余数据 先查出来再删除
SELECT * FROM bbs7_favorite a WHERE EXISTS (SELECT 1 FROM bbs7_topic_1 b WHERE a.tid = b.tid);
-- 删除用户收藏板块的冗余数据
SELECT * FROM bbs7_favorite a WHERE EXISTS
(SELECT 1 FROM (SELECT fid FROM bbs7_forum WHERE deleted = 1) d WHERE a.fid = d.fid)


-- 删除置顶冗余数据
SELECT * FROM bbs7_top a WHERE EXISTS (SELECT 1 FROM bbs7_topic_1 b WHERE a.tid = b.tid);

-- 删除高亮冗余数据
SELECT * FROM bbs7_topic_highlight a WHERE EXISTS (SELECT 1 FROM bbs7_topic_1 b WHERE a.tid = b.tid);




	



   



