Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgZnt-00GGgp-4r for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Sep 2023 00:01:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qgZnr-0041Qu-SJ for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Sep 2023 00:01:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgZnr-0041QZ-Hw for pgsql-hackers@lists.postgresql.org; Thu, 14 Sep 2023 00:01:51 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgZnk-004vh7-E8 for pgsql-hackers@lists.postgresql.org; Thu, 14 Sep 2023 00:01:50 +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 38E01dff3031360; Wed, 13 Sep 2023 20:01:39 -0400 From: Tom Lane To: Nathan Bossart cc: Robert Haas , Alvaro Herrera , Andrew Dunstan , pgsql-hackers@lists.postgresql.org Subject: Re: Inefficiency in parallel pg_restore with many tables In-reply-to: <20230913224753.GA1237642@nathanxps13> References: <1225141.1690069670@sss.pgh.pa.us> <20230723055703.GA2421212@nathanxps13> <20230724190015.GA2528613@nathanxps13> <20230725185336.GA2911441@nathanxps13> <20230901205248.GA3184752@nathanxps13> <20230902185521.GA3414119@nathanxps13> <20230904230829.GA3826808@nathanxps13> <2393313.1694363710@sss.pgh.pa.us> <20230913183450.GA1042742@nathanxps13> <20230913224753.GA1237642@nathanxps13> Comments: In-reply-to Nathan Bossart message dated "Wed, 13 Sep 2023 15:47:53 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3031358.1694649699.1@sss.pgh.pa.us> Date: Wed, 13 Sep 2023 20:01:39 -0400 Message-ID: <3031359.1694649699@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart writes: > Upon closer inspection, I found a rather nasty problem. The qsort > comparator expects a TocEntry **, but the binaryheap comparator expects a > TocEntry *, and we simply pass the arguments through to the qsort > comparator. In v9, I added the requisite ampersands. Ooops :-( > I'm surprised this > worked at all. Probably it was not sorting things appropriately. Might be worth adding some test scaffolding to check that bigger tasks are chosen before smaller ones. regards, tom lane