Andrzej,

> > Btw, versions of amavisd prior to 2.4.0 (which started suggesting
> > the use of a foreign key) had the following example in README.sql:
> >
> > DELETE FROM msgs WHERE UNIX_TIMESTAMP()-time_num > 7*24*60*60;
> > DELETE FROM msgs WHERE UNIX_TIMESTAMP()-time_num > 60*60
> >   AND content IS NULL;

> Mark, that would surely prevent index on time_num from being used, so
> this query would be the slowest one...

I was quoting the old README.sql.


The current release notes (2.5.2) suggests a swapped order:

  README.sql-mysql:
DELETE FROM msgs WHERE time_num < UNIX_TIMESTAMP()-14*24*60*60;
DELETE FROM msgs WHERE time_num < UNIX_TIMESTAMP()-60*60 AND content IS NULL;

  README.sql-pg:
DELETE FROM msgs WHERE time_iso < now() - INTERVAL '3 weeks';
DELETE FROM msgs WHERE time_iso < now() - INTERVAL '1 h' AND content IS NULL;

At least on PostgreSQL it does use an index on time_iso.

  Mark

-------------------------------------------------------------------------
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/

Reply via email to