X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 699A3D9D13; Sat, 1 Oct 2005 05:21:11 -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 83456-01; Sat, 1 Oct 2005 08:21:08 +0000 (GMT) Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by svr1.postgresql.org (Postfix) with ESMTP id B5D7AD9D44; Sat, 1 Oct 2005 05:21:06 -0300 (ADT) Received: from 192.168.0.3 (unknown [84.12.173.204]) by smtp.nildram.co.uk (Postfix) with ESMTP id C48B12532AF; Sat, 1 Oct 2005 09:21:06 +0100 (BST) Subject: Re: [HACKERS] A Better External Sort? From: Simon Riggs To: josh@agliodbs.com Cc: Ron Peacetree , pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org In-Reply-To: <200509301341.22795.josh@agliodbs.com> References: <31833713.1128111650174.JavaMail.root@elwamui-polski.atl.sa.earthlink.net> <200509301341.22795.josh@agliodbs.com> Content-Type: text/plain Organization: 2nd Quadrant Date: Fri, 30 Sep 2005 23:21:16 +0100 Message-Id: <1128118876.4045.53.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.261 required=5 tests=[DATE_IN_PAST_06_12=0.211, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/2 X-Sequence-Number: 14770 On Fri, 2005-09-30 at 13:41 -0700, Josh Berkus wrote: > Yeah, that's what I thought too. But try sorting an 10GB table, and > you'll see: disk I/O is practically idle, while CPU averages 90%+. We're > CPU-bound, because sort is being really inefficient about something. I > just don't know what yet. > > If we move that CPU-binding to a higher level of performance, then we can > start looking at things like async I/O, O_Direct, pre-allocation etc. that > will give us incremental improvements. But what we need now is a 5-10x > improvement and that's somewhere in the algorithms or the code. I'm trying to keep an open mind about what the causes are, and I think we need to get a much better characterisation of what happens during a sort before we start trying to write code. It is always too easy to jump in and tune the wrong thing, which is not a good use of time. The actual sort algorithms looks damn fine to me and the code as it stands is well optimised. That indicates to me that we've come to the end of the current line of thinking and we need a new approach, possibly in a number of areas. For myself, I don't wish to be drawn further on solutions at this stage but I am collecting performance data, so any test results are most welcome. Best Regards, Simon Riggs