1 | set @a=to_days(current_date()); |
---|
2 | |
---|
3 | delete quick from dspam_signature_data |
---|
4 | where @a-14 > to_days(created_on) |
---|
5 | AND uid > 1; |
---|
6 | |
---|
7 | optimize table dspam_signature_data; |
---|
8 | |
---|
9 | delete quick from dspam_token_data |
---|
10 | where (innocent_hits*2) + spam_hits < 5 |
---|
11 | and @a-to_days(last_hit) > 60 |
---|
12 | and uid > 1; |
---|
13 | |
---|
14 | delete quick from dspam_token_data |
---|
15 | where innocent_hits = 1 and spam_hits = 0 |
---|
16 | and @a-to_days(last_hit) > 15 |
---|
17 | and uid > 1; |
---|
18 | |
---|
19 | delete quick from dspam_token_data |
---|
20 | where innocent_hits = 0 and spam_hits = 1 |
---|
21 | and @a-to_days(last_hit) > 15 |
---|
22 | and uid > 1; |
---|
23 | |
---|
24 | delete quick from dspam_token_data |
---|
25 | USING |
---|
26 | dspam_token_data LEFT JOIN dspam_preferences |
---|
27 | ON dspam_token_data.uid = dspam_preferences.uid |
---|
28 | AND dspam_preferences.preference = 'trainingMode' |
---|
29 | AND dspam_preferences.value in('TOE','TUM','NOTRAIN') |
---|
30 | WHERE @a-to_days(dspam_token_data.last_hit) > 90 |
---|
31 | AND dspam_preferences.uid IS NULL |
---|
32 | AND dspam_token_data.uid > 1 ; |
---|
33 | |
---|
34 | delete quick from dspam_token_data |
---|
35 | USING |
---|
36 | dspam_token_data LEFT JOIN dspam_preferences |
---|
37 | ON dspam_token_data.uid = dspam_preferences.uid |
---|
38 | AND dspam_preferences.preference = 'trainingMode' |
---|
39 | AND dspam_preferences.value = 'TUM' |
---|
40 | WHERE @a-to_days(dspam_token_data.last_hit) > 90 |
---|
41 | AND innocent_hits + spam_hits < 50 |
---|
42 | AND dspam_preferences.uid IS NOT NULL |
---|
43 | AND dspam_token_data.uid > 1; |
---|
44 | |
---|
45 | optimize table dspam_token_data; |
---|