Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id EDDFF9FB25F for ; Thu, 18 Jan 2007 06:52:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 54259-06 for ; Thu, 18 Jan 2007 06:52:29 -0400 (AST) X-Greylist: delayed 00:28:23.548501 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 31F7C9FA39A for ; Thu, 18 Jan 2007 06:52:39 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) by svr4.postgresql.org (Postfix) with ESMTP id 2B5465AF982 for ; Thu, 18 Jan 2007 10:24:14 +0000 (GMT) Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) by olive.qinip.net (Postfix) with ESMTP id 26B931807B; Thu, 18 Jan 2007 11:24:08 +0100 (MET) Message-ID: <45AF4ACA.5060805@tweakers.net> Date: Thu, 18 Jan 2007 11:24:10 +0100 From: Arjen van der Meijden User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Adam Rich Cc: 'Bricklen Anderson' , pgsql-performance@postgresql.org Subject: Re: Configuration Advice References: <090501c73a90$7f154330$6400a8c0@dualcore> In-Reply-To: <090501c73a90$7f154330$6400a8c0@dualcore> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 0703-3, 17-01-2007), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/304 X-Sequence-Number: 22905 On 18-1-2007 0:37 Adam Rich wrote: > 4) Complex queries that might take advantage of the MySQL "Query Cache" > since the base data never changes Have you ever compared MySQL's performance with complex queries to PostgreSQL's? I once had a query which would operate on a recordlist and see whether there were any gaps larger than 1 between consecutive primary keys. Normally that information isn't very usefull, but this time it was. Since the data was in MySQL I tried several variations of queries in MySQL... After ten minutes or so I gave up waiting, but left my last version running. In the mean time I dumped the data, reloaded the data in PostgreSQL and ran some testqueries there. I came up with a query that took only 0.5 second on Postgres pretty soon. The query on MySQL still wasn't finished... In my experience it is (even with the 5.0 release) easier to get good performance from complex queries in postgresql. And postgresql gives you more usefull information on why a query takes a long time when using explain (analyze). There are some draw backs too of course, but while we in our company use mysql I switched to postgresql for some readonly complex query stuff just for its performance... Besides that, mysql rewrites the entire table for most table-altering statements you do (including indexes). For small tables that's no issue, but if you somehow can't add all your indexes in a single statement to a table you'll be waiting a long time more for new indexes than with postgresql. And that situation isn't so unusual if you think of a query which needs an index that isn't there yet. Apart from the fact that it doesn't have functional indexes and such. Long story short: MySQL still isn't the best performer when looking at the more complex queries. I've seen performance which made me assume it can't optimise sequential scans (when it is forced to loop using a seq scan it appears to do a new seq scan for each round in the loop...) and various other cases PostgreSQL can execute much more efficiently. So unless you run the same queries a lot of times and know of a way to get it fast enough the initial time, the query cache is not much of a help. Best regards, Arjen