Gary wrote: > Mark wrote:
>> Paolo Cravero writes: >>> 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_: >> Paolo advice seems to be a good solution. > I wonder if Paolo would share his scripts? I came up with this as an example: #!/bin/bash echo "USE amavis;" >amavistrim.sql mysql -uamavis -pamavis_password amavis -B -N -e "SELECT CONCAT('DELETE FROM msgs WHERE mail_id = ', CHAR(39), mail_id, CHAR(39), ' LIMIT 1;' ) FROM msgs WHERE time_iso < NOW() - INTERVAL 14 DAY;" >>amavistrim.sql mysql -uamavis -pamavis_password <amavistrim.sql # cat amavistrim.sql USE amavis; DELETE FROM msgs WHERE mail_id = 'W1CPj2MVZX-3' LIMIT 1; DELETE FROM msgs WHERE mail_id = 'tMXbu4C7R1Bj' LIMIT 1; DELETE FROM msgs WHERE mail_id = 'lvyaj5Dfd8Ns' LIMIT 1; <...> Gary V ------------------------------------------------------------------------- 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 AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/