Re: [AMaViS-user] SQL-Quarantine DB LOCK while cleaning

This is a discussion on Re: [AMaViS-user] SQL-Quarantine DB LOCK while cleaning within the Amavis User forums, part of the Anti-Spam and Anti-Virus Related Forums category; Hi Egon, our traffic peaks at 1Mmsg/day on weaker hardware than yours, and I worked out a workaround that: - ...


Go Back   Usenet Forums > Anti-Spam and Anti-Virus Related Forums > Amavis User

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-09-2007
Paolo Cravero
 
Posts: n/a
Default Re: [AMaViS-user] SQL-Quarantine DB LOCK while cleaning

Hi Egon,
our traffic peaks at 1Mmsg/day on weaker hardware than yours, and I worked out
a workaround that:

- completes the cleaning in 12 hours
- does not lock the DB

My deletion procedure takes advantage of the "ON DELETE CASCADE" on MySQL/InnoDB.

How do we do it? Rather than running a single deletion query "DELETE FROM
msgs", I do a "SELECT mail_id FROM msgs WHERE ..." to get candidate message
IDs from the database. I pipe the output through a sed command and create a
long list of _single delete statements_:

DELETE FROM msgs WHERE mail_id = '0sdfsddfk';
DELETE FROM msgs WHERE mail_id = '4904fkfkf';
DELETE FROM msgs WHERE mail_id = 'ddkkkddkd';
.....

Then I run the SQL script as an input to mysql command line client.

I am NOT deleting/cleaning maddr, although I should do it one day or another
to limit table grow.

I DO NOT recreate indexes.

Hope this helps,
Paolo

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/...fo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:53 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0