Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxAf1-0005zp-Qj for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Dec 2021 16:28:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mxAf0-0005Mj-MP for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Dec 2021 16:28:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxAf0-0005Ma-EY for pgsql-bugs@lists.postgresql.org; Tue, 14 Dec 2021 16:28:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxAey-0003ki-6h for pgsql-bugs@lists.postgresql.org; Tue, 14 Dec 2021 16:28:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1BEGS7UM262746; Tue, 14 Dec 2021 11:28:07 -0500 From: Tom Lane To: ma100@hotmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17336: logtape sort performance and overflow In-reply-to: <17336-fc4e522d26a750fd@postgresql.org> References: <17336-fc4e522d26a750fd@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 14 Dec 2021 08:53:13 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <262744.1639499287.1@sss.pgh.pa.us> Date: Tue, 14 Dec 2021 11:28:07 -0500 Message-ID: <262745.1639499287@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > In logtape.c, > * Each `swap_nodes` will execute assignment statement three times, while > we only need execute once like in tuplesort.c Yeah, that could be improved. I see similar coding in binaryheap.c, too. > * right_offset(unsigned i) parameter i seemed should be `unsigned long` Ugh, that's surely wrong. I don't know that anyone could get to >4G entries in this heap, but it's still wrong. Thanks for the report! > Here's a patch FYI, patches tend not to survive being passed through email unless you add 'em as attachments. regards, tom lane