source: npl/mailserver/dspam/cleanup.sql @ 0105685

gcc484ntopperl-5.22
Last change on this file since 0105685 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 1.3 KB
Line 
1set @a=to_days(current_date());
2
3delete quick from dspam_signature_data
4  where @a-14 > to_days(created_on)
5  AND uid > 1;
6
7optimize table dspam_signature_data;
8
9delete 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
14delete 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
19delete 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
24delete quick from dspam_token_data
25USING
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')
30WHERE @a-to_days(dspam_token_data.last_hit) > 90
31AND dspam_preferences.uid IS NULL
32AND dspam_token_data.uid > 1 ;
33
34delete quick from dspam_token_data
35USING
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'
40WHERE @a-to_days(dspam_token_data.last_hit) > 90
41AND innocent_hits + spam_hits < 50
42AND dspam_preferences.uid IS NOT NULL
43AND dspam_token_data.uid > 1;
44
45optimize table dspam_token_data;
Note: See TracBrowser for help on using the repository browser.