Casey Allen Shobe wrote the following on 11/27/04 03:11 :
I posted about this a couple days ago on dspam-dev...
I am using DSpam with PostgreSQL, and like you discovered the horrible
performance. The reason is because the default PostgreSQL query planner
settings determine that a sequence scan will be more efficient than an
index scan, which is wrong. To correct this behavior, adjust the query
planner settings for the appropriate table/column with this command:
alter table "dspam_token_data" alter "token" set statistics 200; analyze;
Let me know if it help you. It worked wonders for me.
In tum mode, this could help too (I'm currently testing it) :
CREATE INDEX id_token_data_sumhits ON dspam_token_data ((spam_hits +
innocent_hits));
Indeed each UPDATE on dspam_token_data in TUM is done with :
WHERE ... AND spam_hits + innocent_hits < 50