Skip to content

Commit 989d94a

Browse files
committed
Update TODO.detail/qsort.
1 parent 8da3080 commit 989d94a

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

doc/TODO.detail/qsort

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,3 +988,92 @@ since
988988
> Servus
989989
> Manfred
990990

991+
From pgsql-hackers-owner@postgresql.org Mon Dec 19 13:36:58 2005
992+
X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org
993+
Received: from localhost (av.hub.org [200.46.204.144])
994+
by postgresql.org (Postfix) with ESMTP id 1E0CC9DC810
995+
for <pgsql-hackers-postgresql.org@localhost.postgresql.org>; Mon, 19 Dec 2005 13:36:58 -0400 (AST)
996+
Received: from postgresql.org ([200.46.204.71])
997+
by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024)
998+
with ESMTP id 89341-07
999+
for <pgsql-hackers-postgresql.org@localhost.postgresql.org>;
1000+
Mon, 19 Dec 2005 13:36:52 -0400 (AST)
1001+
X-Greylist: from auto-whitelisted by SQLgrey-
1002+
Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46])
1003+
by postgresql.org (Postfix) with ESMTP id 348A69DC9C2
1004+
for <pgsql-hackers@postgresql.org>; Mon, 19 Dec 2005 13:36:51 -0400 (AST)
1005+
Received: from 172.16.1.25 by mail.mi8.com with ESMTP (- Welcome to Mi8
1006+
Corporation www.Mi8.com (D2)); Mon, 19 Dec 2005 12:36:45 -0500
1007+
X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1
1008+
Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by
1009+
D01HOST03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 19 Dec
1010+
2005 12:36:44 -0500
1011+
Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com (
1012+
[172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com (
1013+
[172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Mon, 19 Dec
1014+
2005 17:36:44 +0000
1015+
User-Agent: Microsoft-Entourage/11.2.1.051004
1016+
Date: Mon, 19 Dec 2005 09:36:44 -0800
1017+
Subject: Re: Re: Which qsort is used
1018+
From: "Luke Lonergan" <llonergan@greenplum.com>
1019+
To: "Martijn van Oosterhout" <kleptog@svana.org>,
1020+
"Dann Corbit" <DCorbit@connx.com>
1021+
cc: "Tom Lane" <tgl@sss.pgh.pa.us>,
1022+
"Qingqing Zhou" <zhouqq@cs.toronto.edu>,
1023+
"Bruce Momjian" <pgman@candle.pha.pa.us>,
1024+
"Neil Conway" <neilc@samurai.com>,
1025+
pgsql-hackers@postgresql.org
1026+
Message-ID: <BFCC2FAC.16CC0%llonergan@greenplum.com>
1027+
Thread-Topic: [HACKERS] Re: Which qsort is used
1028+
Thread-Index: AcYEkKvEA7duDr/yQneMyWGCfNr3rQAMhuDl
1029+
In-Reply-To: <20051219113724.GD12251@svana.org>
1030+
MIME-Version: 1.0
1031+
X-OriginalArrivalTime: 19 Dec 2005 17:36:44.0849 (UTC)
1032+
FILETIME=[C7C6AA10:01C604C2]
1033+
X-WSS-ID: 6FB830272346940585-01-01
1034+
Content-Type: text/plain;
1035+
charset=us-ascii
1036+
Content-Transfer-Encoding: 7bit
1037+
X-Virus-Scanned: by amavisd-new at hub.org
1038+
X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000,
1039+
RCVD_NUMERIC_HELO=1.253]
1040+
X-Spam-Score: 1.253
1041+
X-Spam-Level: *
1042+
X-Archive-Number: 200512/868
1043+
X-Sequence-Number: 77716
1044+
Status: OR
1045+
1046+
Martin,
1047+
1048+
On 12/19/05 3:37 AM, "Martijn van Oosterhout" <kleptog@svana.org> wrote:
1049+
1050+
> I'm not sure whether we have a conclusion here, but I do have one
1051+
> question: is there a significant difference in the number of times the
1052+
> comparison routines are called? Comparisons in PostgreSQL are fairly
1053+
> expensive given the fmgr overhead and when comparing tuples it's even
1054+
> worse.
1055+
1056+
It would be interesting to note the comparison count of the different
1057+
routines.
1058+
1059+
Something that really grabbed me about the results though is that the
1060+
relative performance of the routines dramatically shifted when the indirect
1061+
references in the comparators went in. The first test I did sorted an array
1062+
of int4 - these tests that Qingqing did sorted arrays using an indirect
1063+
pointer list, at which point the same distributions performed very
1064+
differently.
1065+
1066+
I suspect that it is the number of comparisons that caused this, and further
1067+
that the indirection has disabled the compiler optimizations for memory
1068+
prefetch and other things that it could normally recognize. Given the usage
1069+
pattern in Postgres, where sorted things are a mix of strings and intrinsic
1070+
types, I'm not sure those optimizations could be done by one routine.
1071+
1072+
I haven't verified this, but it certainly seems that the NetBSD routine is
1073+
the overall winner for the type of use that Postgres has (sorting the using
1074+
a pointer list).
1075+
1076+
- Luke
1077+
1078+
1079+

0 commit comments

Comments
 (0)