-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

With a bayes_token db of ~125000 entries the system ground to a halt.
 Time to look further...

The sample creation script creates a primary key but no index.  Postgres
creates the constraint but not the index to support the PK.  So, all
queries resulted in a full table scan.  Not good.

So, I created a unique index in the same order as the primary key
definition.  (id, token).  Not smart.  Since I'm running with only 1
user, id is always a single value.  Queries using that id would always
result in a table scan (dunno why).

Creating the index as so:

CREATE UNIQUE INDEX pk_bayes_token
  ON bayes_token
  USING btree
  (token, id);

resulted in reasonable performance (queries with large inlist in the
tokens are around 100ms rather than 20s).

I also created a similar index on bayes_seen:

CREATE UNIQUE INDEX "pk_ bayes_seen"
  ON bayes_seen
  USING btree
  (msgid, id);

- --
 -Rupa

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBnBPLL3Aub+krmycRArwsAJ9ZYmxHZYf3R9/gZZ60+LB2t5nRJACffUdr
uqKGCf9eYwocVABrPt5oNIY=
=+36w
-----END PGP SIGNATURE-----

Reply via email to