Package: spamassassin
Version: 3.2.3-1
Followup-For: Bug #409334

For what it's worth, I've been seeing this as well with a postgres
backend.  I've just added this fairly minimal patch, and it seems to be
helping.  The reason for it is first to create an index on id,atime, as
that is a heavily used query tuple, and the tables have gotten fairly
large.  Doing multiple sequential scans was just not fun.  Then, to
actually consistently use that index, I had to modify one query.

Thanks,

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.23-1-686 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages spamassassin depends on:
ii  libarchive-tar-perl           1.36-1     Archive::Tar - manipulate tar file
ii  libdigest-sha1-perl           2.11-2     NIST SHA-1 message digest algorith
ii  libhtml-parser-perl           3.56-1     A collection of modules that parse
ii  libio-zlib-perl               1.04-1     IO:: style interface to Compress::
ii  libnet-dns-perl               0.60-1     Perform DNS queries from a Perl sc
ii  libsocket6-perl               0.19-1     Perl extensions for IPv6
ii  libsys-hostname-long-perl     1.4-1      Figure out the long (fully-qualifi
ii  libwww-perl                   5.805-1    WWW client/server library for Perl
ii  perl                          5.8.8-12   Larry Wall's Practical Extraction 

Versions of packages spamassassin recommends:
ii  gcc                          4:4.2.1-6   The GNU C compiler
ii  gnupg                        1.4.6-2     GNU privacy guard - a free PGP rep
ii  libc6-dev                    2.7-3       GNU C Library: Development Librari
ii  libmail-spf-query-perl       1:1.999.1-3 query SPF (Sender Policy Framework
pn  libsys-syslog-perl           <none>      (no description available)
ii  make                         3.81-3      The GNU version of the "make" util
pn  re2c                         <none>      (no description available)
pn  spamc                        <none>      (no description available)

-- no debconf information

-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        [EMAIL PROTECTED] |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------
--- spamassassin-3.2.3.orig/sql/bayes_pg.sql
+++ spamassassin-3.2.3/sql/bayes_pg.sql
@@ -31,6 +31,7 @@
 ) WITHOUT OIDS;
 
 CREATE INDEX bayes_token_idx1 ON bayes_token (token);
+CREATE INDEX bayes_token_atime_idx on bayes_token(id,atime);
 
 CREATE TABLE bayes_vars (
   id serial NOT NULL,
only in patch2:
unchanged:
--- spamassassin-3.2.3.orig/lib/Mail/SpamAssassin/BayesStore/SQL.pm
+++ spamassassin-3.2.3/lib/Mail/SpamAssassin/BayesStore/SQL.pm
@@ -240,7 +240,7 @@
   my $sql = "SELECT count(*)
                FROM bayes_token
               WHERE id = ?
-                AND (? - atime) > ?";
+                AND atime < (? - ?)";
 
   my $sth = $self->{_dbh}->prepare_cached($sql);
     

Attachment: signature.asc
Description: Digital signature

Reply via email to