Re: Performance problems testing with Spamassassin 3.1.0
От | Tom Lane |
---|---|
Тема | Re: Performance problems testing with Spamassassin 3.1.0 |
Дата | |
Msg-id | 15610.1123166222@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Performance problems testing with Spamassassin 3.1.0 (Matthew Schumacher <matt.s@aptalaska.net>) |
Ответы |
Re: Performance problems testing with Spamassassin 3.1.0
Re: Performance problems testing with Spamassassin 3.1.0 |
Список | pgsql-performance |
Matthew Schumacher <matt.s@aptalaska.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
В списке pgsql-performance по дате отправления: