Re: Performance problems testing with Spamassassin 3.1.0

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthew Schumacher <matt(dot)s(at)aptalaska(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance problems testing with Spamassassin 3.1.0
Date: 2005-08-04 14:37:02
Message-ID: 15610.1123166222@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Matthew Schumacher <matt(dot)s(at)aptalaska(dot)net> writes:
> for i in array_lower(intokenary, 1) .. array_upper(intokenary, 1)
> LOOP
> _token := intokenary[i];
> INSERT INTO bayes_token_tmp VALUES (_token);
> END LOOP;

> UPDATE
> bayes_token
> SET
> spam_count = greatest_int(spam_count + inspam_count, 0),
> ham_count = greatest_int(ham_count + inham_count , 0),
> atime = greatest_int(atime, 1000)
> WHERE
> id = inuserid
> AND
> (token) IN (SELECT intoken FROM bayes_token_tmp);

I don't really see why you think that this path is going to lead to
better performance than where you were before. Manipulation of the
temp table is never going to be free, and IN (sub-select) is always
inherently not fast, and NOT IN (sub-select) is always inherently
awful. Throwing a pile of simple queries at the problem is not
necessarily the wrong way ... especially when you are doing it in
plpgsql, because you've already eliminated the overhead of network
round trips and repeated planning of the queries.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message John A Meinel 2005-08-04 15:08:09 Re: Performance problems testing with Spamassassin 3.1.0
Previous Message John A Meinel 2005-08-04 14:10:03 Re: Performance problems testing with Spamassassin 3.1.0