You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/12/16 22:30:05 UTC

svn commit: r604713 - /spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/SQL.pm

Author: jm
Date: Sun Dec 16 13:30:05 2007
New Revision: 604713

URL: http://svn.apache.org/viewvc?rev=604713&view=rev
Log:
bug 5661: speed up Bayes SQL queries by allowing the use of indexes when expiring

Modified:
    spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/SQL.pm

Modified: spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/SQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/SQL.pm?rev=604713&r1=604712&r2=604713&view=diff
==============================================================================
--- spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/SQL.pm (original)
+++ spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/SQL.pm Sun Dec 16 13:30:05 2007
@@ -240,7 +240,7 @@
   my $sql = "SELECT count(*)
                FROM bayes_token
               WHERE id = ?
-                AND (? - atime) > ?";
+                AND atime < ?";
 
   my $sth = $self->{_dbh}->prepare_cached($sql);
     
@@ -250,7 +250,7 @@
   }
 
   for (my $i = 1; $i <= $max_expire_mult; $i<<=1) {
-    my $rc = $sth->execute($self->{_userid}, $newest_atime, $start * $i);
+    my $rc = $sth->execute($self->{_userid}, $newest_atime - $start * $i);
 
     unless ($rc) {
       dbg("bayes: calculate_expire_delta: SQL error: ".$self->{_dbh}->errstr());