X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4709052952 for ; Wed, 27 Jul 2005 23:17:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95222-07 for ; Thu, 28 Jul 2005 02:17:05 +0000 (GMT) Received: from larry.aptalaska.net (larry.aptalaska.net [64.186.96.3]) by svr1.postgresql.org (Postfix) with ESMTP id 6671752883 for ; Wed, 27 Jul 2005 23:17:05 -0300 (ADT) Received: from [192.168.98.9] (rdbck-static-287.palmer.mtaonline.net [64.4.232.33]) (authenticated bits=0) by larry.aptalaska.net (8.13.4/8.13.4) with ESMTP id j6S2UHfr017334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Jul 2005 18:30:18 -0800 Message-ID: <42E84021.9040904@aptalaska.net> Date: Wed, 27 Jul 2005 18:17:05 -0800 From: Matthew Schumacher User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Performance problems testing with Spamassassin 3.1.0 References: <42E80C28.2040608@aptalaska.net> <200507271712.15299.josh@agliodbs.com> <42E83C09.2040508@aptalaska.net> <200507271912.39780.josh@agliodbs.com> In-Reply-To: <200507271912.39780.josh@agliodbs.com> X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Bayes: Learn: unavailable X-Scanned-By: MIMEDefang 2.52 on 64.186.96.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200507/428 X-Sequence-Number: 13669 Josh Berkus wrote: > Matt, > > Well, it might be because we don't have a built-in GREATEST or LEAST prior to > 8.1. However, it's pretty darned easy to construct one. I was more talking about min() and max() but yea, I think you knew where I was going with it... > > Well, there's the general performance tuning stuff of course (postgresql.conf) > which if you've not done any of it will pretty dramatically affect your > througput rates. And vacuum, analyze, indexes, etc. I have gone though all that. > You should also look at ways to make the SP simpler. For example, you have a > cycle that looks like: > > SELECT > IF NOT FOUND > INSERT > ELSE > UPDATE > > Which could be made shorter as: > > UPDATE > IF NOT FOUND > INSERT > > ... saving you one index scan. > > Also, I don't quite follow it, but the procedure seems to be doing at least > two steps that the MySQL version isn't doing at all. If the PG version is > doing more things, of course it's going to take longer. > > Finally, when you have a proc you're happy with, I suggest having an expert > re-write it in C, which should double the procedure performance. > Sounds like I need to completely understand what the proc is doing and work on a rewrite. I'll look into writing it in C, I need to do some reading about how that works and exactly what it buys you. Thanks for the helpful comments. schu