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 1qcjxw-00HPEq-Cj for pgsql-hackers@arkaria.postgresql.org; Sun, 03 Sep 2023 10:04:24 +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 1qcjxt-00028O-Ky for pgsql-hackers@arkaria.postgresql.org; Sun, 03 Sep 2023 10:04:21 +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 1qcjxs-00027z-Fj for pgsql-hackers@lists.postgresql.org; Sun, 03 Sep 2023 10:04:21 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qcjxj-002ili-7N for pgsql-hackers@lists.postgresql.org; Sun, 03 Sep 2023 10:04:19 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 4AC7032008FE; Sun, 3 Sep 2023 06:04:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 03 Sep 2023 06:04:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1693735445; x= 1693821845; bh=izZkO1dMhnHjTAu5TMNkQvvRpb9qETSNdu5J0BVGwzQ=; b=c YthHu8rt4OMFXRNE/OVW3kiWQf8w3wQp3eet3HVEq+imSTY+EsRHHpPqnJZR3mzI n9zEjIiaLSgqUBV2vnFOAXEr1aD0q1m3ttnpSfUw+Loy7pCYQM1Cc57vk3TQOGPI ZMKQQZAq39OVdWcI+tlKswruNfcj9E7SZdfsjZHgqpvebik07gvT8Ue+TlSBoM97 WkZeOPjqLfZYEe2w5HT/pdDvJo2HEXe/KWe2r/tUy9DRztkPSytohD2+LHI9tWVn cimIsUO84sCWys6bqy9lq2FCZZK93W6X5tQJDY1UmuXeCDbQn83wIz7w9OJN+PL7 WSReOfRcBVBjoDcB02Yww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudegiedgvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 3 Sep 2023 06:04:05 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 573D9AF; Sun, 3 Sep 2023 12:04:00 +0200 (CEST) Date: Sun, 3 Sep 2023 12:04:00 +0200 From: Alvaro Herrera To: Nathan Bossart Cc: Robert Haas , Tom Lane , Andrew Dunstan , pgsql-hackers@lists.postgresql.org Subject: Re: Inefficiency in parallel pg_restore with many tables Message-ID: <20230903100400.nbmajh4ppz5tkzff@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230902185521.GA3414119@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Sep-02, Nathan Bossart wrote: > On Fri, Sep 01, 2023 at 01:52:48PM -0700, Nathan Bossart wrote: > > Yeah, something similar to simplehash for binary heaps could be nice. That > > being said, I don't know if there's a strong reason to specialize the > > implementation for a given C data type in most cases. > > I ended up hacking together a (nowhere near committable) patch to see how > hard it would be to allow using any type with binaryheap. It doesn't seem > too bad. Yeah, using void * seems to lead to interfaces that are pretty much the same as bsearch() or qsort(). (Why isn't your payload type const, though?) I do wonder why did you change _remove_first and _first to have a 'result' output argument instead of a return value. Does this change actually buy you anything? simplehash.h doesn't do that either. > -extern void binaryheap_add(binaryheap *heap, Datum d); > -extern Datum binaryheap_first(binaryheap *heap); > -extern Datum binaryheap_remove_first(binaryheap *heap); > -extern void binaryheap_replace_first(binaryheap *heap, Datum d); > +extern void binaryheap_add(binaryheap *heap, void *d); > +extern void binaryheap_first(binaryheap *heap, void *result); > +extern void binaryheap_remove_first(binaryheap *heap, void *result); > +extern void binaryheap_replace_first(binaryheap *heap, void *d); -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/