On 8/19/07, Andrzej Kukula <[EMAIL PROTECTED]> wrote:
> Hello,
>
> On 8/17/07, Nate <[EMAIL PROTECTED]> wrote:
> >
> > Just for reference, the queray, down from 3 hours
> > when using foreign keys.ies I'm doing to clean the database now
> > with foreign keys removed in mysql. I believe this is catching
> > everything, and taking roughly 7 minutes per d
> >
> > # clear msgs table for anything older than $days_quarantine
> > DELETE LOW_PRIORITY FROM msgs WHERE time_num < UNIX_TIMESTAMP() -
> > $days_quarantine*24*60*60
>
> Maybe get the value of
> UNIX_TIMESTAMP() - $days_quarantine*24*60*60
> assigned to a variable before executing the query to avoid calculating
> UNIX_TIMESTAMP() for each scanned row.
>
> > # delete anythign that's not quarantined longer than we keep data for
> > penpals
> > DELETE LOW_PRIORITY FROM msgs WHERE quar_type != 'Q' AND (time_num <
> > UNIX_TIMESTAMP() - $penpal_days*24*60*60)
>
> != is very slow operator, testing the nonexistance of a value can lead
> to full table scan in many cases. Change it to
> IN (' ','F','Z','B','Q','M','L')
> this should work much faster.
Sorry, without 'Q' of course...
> Regards,
> Andrzej
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/