On 09/24/09 09:21, quoth Benny Pedersen:
> On tor 24 sep 2009 04:57:57 CEST, "Steven W. Orr" wrote
>> Since I haven't *ever* touched this table for cleanup, the above
>> described cron job will not delete any rows for that period of time.
> 
> you will have less problems with innodb then myisam
> 
> here is my complete spamassassin sql setup, not showing tables that is
> standard here
> 
> CREATE TABLE `awl` (
>   `username` varchar(100) NOT NULL default '',
>   `email` varchar(200) NOT NULL default '',
>   `ip` varchar(10) NOT NULL default '',
>   `count` int(11) default '0',
>   `totscore` float default '0',
>   `lastupdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update
> CURRENT_TIMESTAMP,
>   PRIMARY KEY  (`username`,`email`,`ip`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> 
> CREATE TABLE `bayes_seen` (
>   `id` int(11) NOT NULL default '0',
>   `msgid` varchar(200) character set utf8 collate utf8_bin NOT NULL
> default '',
>   `flag` char(1) NOT NULL default '',
>   `lastupdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update
> CURRENT_TIMESTAMP,
>   PRIMARY KEY  (`id`,`msgid`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> 
> this 2 table will need to be expired from cron
> 
> CREATE TABLE `bayes_token` (
>   `id` int(11) NOT NULL default '0',
>   `token` char(5) NOT NULL default '',
>   `spam_count` int(11) NOT NULL default '0',
>   `ham_count` int(11) NOT NULL default '0',
>   `atime` int(11) NOT NULL default '0',
>   PRIMARY KEY  (`id`,`token`),
>   KEY `bayes_token_idx1` (`token`),
>   KEY `bayes_token_idx2` (`id`,`atime`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> 
> last table will expire in standard way, this setup is
> working in 3.2.5 and its not bugging down my mysql server
> 
> if you change your db to lastupdate now() then all data
> will get added as today even thay are not added for real
> today, but the expire will expire okay later
> 

I have all my SA tables up and running using InnoDB and using the above table
definitions. I just have one question:

Will the cronjob that was described here earlier

#!/bin/sh
howfar='where lastupdate < date_sub(now(), interval 3 month)'
mysql -h localhost -u sa -pssaa spamassassin <<EOF
        delete from awl $howfar ;
        delete from bayes_seen $howfar ;
EOF

also clean up the bayes_token table, or is there another cron job I should use
for that?

And, why is bayes_token.atime int(11) instead of
timestamp NOT NULL default CURRENT_TIMESTAMP on update
?

Is this a part of the design or is it more efficient?

TIA

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to