You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2007/10/07 22:30:38 UTC

[Bug 5670] New: Optimize Bayes SQL queries

http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5670

           Summary: Optimize Bayes SQL queries
           Product: Spamassassin
           Version: 3.2.1
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: minor
          Priority: P5
         Component: spamassassin
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: Thorsten@meinl.bnv-bamberg.de


Autoexpiry of Bayes tokens may take some time, if the SQL database is huge. This
may sometimes lead to timeouts of the spamd process. It helps to create an
additional index bayes_token(id, atime) to speed up auto-expiry. However, at
leas one query in this process is not optimized, so that the database (Postgres
in our case) cannot make use of the index, which is
Bayes::SQL::calculate_expire_delta:

SELECT count(*) FROM bayes_token WHERE id = ? AND (? - atime) > ?

By simple rearranging the second condition to

SELECT count(*) FROM bayes_token WHERE id = ? AND atime < (? - ?)

the index can be used and auto-expiry is *much* faster.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5670] Optimize Bayes SQL queries

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5670


Thorsten@meinl.bnv-bamberg.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From Thorsten@meinl.bnv-bamberg.de  2007-10-07 13:42 -------
Sorry, after some testing this does not work in all cases.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.