Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 04C969F9F49 for ; Tue, 5 Dec 2006 14:39:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 92479-05 for ; Tue, 5 Dec 2006 14:39:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 110B59F9398 for ; Tue, 5 Dec 2006 14:39:19 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kB5IdG8U009447; Tue, 5 Dec 2006 13:39:16 -0500 (EST) To: "Steinar H. Gunderson" cc: pgsql-performance@postgresql.org Subject: Re: Performance of ORDER BY In-reply-to: <20061205181733.GA10309@uio.no> References: <4575A863.6040504@varianinc.com> <7090.1165341726@sss.pgh.pa.us> <20061205181733.GA10309@uio.no> Comments: In-reply-to "Steinar H. Gunderson" message dated "Tue, 05 Dec 2006 19:17:33 +0100" Date: Tue, 05 Dec 2006 13:39:16 -0500 Message-ID: <9446.1165343956@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/90 X-Sequence-Number: 22146 "Steinar H. Gunderson" writes: > By the way, is the new sorting code any better for platforms that already > have a decent qsort() (like Linux)? It seemed better to us. Linux' qsort() is really mergesort, which is better sometimes but often worse --- mergesort tends to have a less CPU-cache-friendly memory access distribution. Another big problem with the Linux version is that it pays no attention to sort_mem, but will enthusiastically allocate lots of additional memory, thereby blowing whatever cross-backend memory budgeting you might have been doing. If you care there is quite a lot of discussion in the -hackers and -performance archives from last spring or so. regards, tom lane