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 1tzbhe-004BSj-9V for pgsql-committers@arkaria.postgresql.org; Tue, 01 Apr 2025 13:30:54 +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 1tzbhd-002K5D-1U for pgsql-committers@arkaria.postgresql.org; Tue, 01 Apr 2025 13:30:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzbhc-002K54-Qb for pgsql-committers@lists.postgresql.org; Tue, 01 Apr 2025 13:30:52 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tzbha-002Lct-1D for pgsql-committers@lists.postgresql.org; Tue, 01 Apr 2025 13:30:51 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id A1F06138443A; Tue, 1 Apr 2025 09:30:49 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 01 Apr 2025 09:30:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1743514249; x=1743600649; bh=sfJu9gzwYUlmQf8Lc2eNbqb0EYa1RRtZWSNZf3P1W4E=; b= MzmL+aAaNhKuJHXuQoMLMvNWDGi5a3USGsw/XwsO5cHWgfbYeI3IufJpqzrui1ui ToDFsR0lmCtD4hzLBNmRVTpXXfgZrEfn6US9ZJKRVetzsiehiJHtHIUme3M5jSgk DGIBGxD9G9W/QINgaErYUA4SWIp7APFAerWEwg/H0SG7C+G7DLBbKBOkGKibLXMt 4oz81KhkZ2zHT60Uz8hv8QjHfe7fnJTCM7JX8QWLRCL7i98ov4Ts3u7GcmsBCDwv fKBdXgfbz05WZZWpivqhXu65azndwzgVuujFrzt2Btu4PBiSeTK/D0tXnjbQANsq DSIjKhCVMeQju83ZYr/Onw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1743514249; x=1743600649; bh=s fJu9gzwYUlmQf8Lc2eNbqb0EYa1RRtZWSNZf3P1W4E=; b=wqBnaO6DF0kCT9CHn H1kTqioJBFvvftSmsdQaZeD/6JcfrJaUNUtBQ9WrT2B3RAO+uTn4E2aIE3kbmfrx PX3YJZvdEBlyGYRVPzF/yVd02OOvIHlNB54sEVEe7D44iRk3YzqE+c9WdkIrbUvx XTdnzk5SDV6+kxGmSmCHIoDNlfJkPB2kyPtu8xX83Xn5bM5Xdzy7GkbMqaknc2xY mK6Tb2HDZZwjXFqMEGr6zBW3JFlBNPtYSlKJJMCUTgJgXuGC/G8w6HfI9UBD4sKF 8h5ORMJEsZ98MlXJCQLz8rC8ZMKaIWTUWq4o8+ynmK41EFFLYkV8SXrCWkEefzVD aTOCA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddukedvleduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffhvfhfjggtgfesthekredttddv jeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhesvghish gvnhhtrhgruhhtrdhorhhgqeenucggtffrrghtthgvrhhnpeefvefhhfejheejffetkedt ieffieehgeehieduudeggfeigedutedvteevhfdtieenucffohhmrghinhepphhoshhtgh hrrdgvshdpphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorh hgpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeht ohhmrghsrdhvohhnughrrgesphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepph hgshhqlhdqtghomhhmihhtthgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhr gh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Apr 2025 09:30:48 -0400 (EDT) Message-ID: <83b0c9ce-06ad-4aec-915f-d97ccc0362e3@eisentraut.org> Date: Tue, 1 Apr 2025 15:30:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Allow parallel CREATE INDEX for GIN indexes From: Peter Eisentraut To: Tomas Vondra , pgsql-committers@lists.postgresql.org References: <35b1a8bd-5501-407f-b100-22f91834fcc8@eisentraut.org> Content-Language: en-US In-Reply-To: <35b1a8bd-5501-407f-b100-22f91834fcc8@eisentraut.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 07.03.25 22:22, Peter Eisentraut wrote: > The new tuplesort_getgintuple() in tuplesortvariants.c has a branch that > does "return false" even though the function's return type is GinTuple > *.  That is probably a mistake.  Check please. > > Also, this code contains a "pgrminclude ignore", but we don't use those > anymore. Fixed committed. > On 03.03.25 17:10, Tomas Vondra wrote: >> Allow parallel CREATE INDEX for GIN indexes >> >> Allow using parallel workers to build a GIN index, similarly to BTREE >> and BRIN. For large tables this may result in significant speedup when >> the build is CPU-bound. >> >> The work is divided so that each worker builds index entries on a subset >> of the table, determined by the regular parallel scan used to read the >> data. Each worker uses a local tuplesort to sort and merge the entries >> for the same key. The TID lists do not overlap (for a given key), which >> means the merge sort simply concatenates the two lists. The merged >> entries are written into a shared tuplesort for the leader. >> >> The leader needs to merge the sorted entries again, before writing them >> into the index. But this way a significant part of the work happens in >> the workers, and the leader is left with merging fewer large entries, >> which is more efficient. >> >> Most of the parallelism infrastructure is a simplified copy of the code >> used by BTREE indexes, omitting the parts irrelevant for GIN indexes >> (e.g. uniqueness checks). >> >> Original patch by me, with reviews and substantial improvements by >> Matthias van de Meent, certainly enough to make him a co-author. >> >> Author: Tomas Vondra, Matthias van de Meent >> Reviewed-by: Matthias van de Meent, Andy Fan, Kirill Reshke >> Discussion: https://postgr.es/m/6ab4003f-a8b8-4d75-a67f- >> f25ad98582dc%40enterprisedb.com >> >> Branch >> ------ >> master >> >> Details >> ------- >> https://git.postgresql.org/pg/ >> commitdiff/8492feb98f6df3f0f03e84ed56f0d1cbb2ac514c >> >> Modified Files >> -------------- >> src/backend/access/gin/gininsert.c         | 1649 ++++++++++++++++++++ >> +++++++- >> src/backend/access/gin/ginutil.c           |   30 +- >> src/backend/access/transam/parallel.c      |    4 + >> src/backend/utils/sort/tuplesortvariants.c |  198 ++++ >> src/include/access/gin.h                   |   15 + >> src/include/access/gin_private.h           |    1 + >> src/include/access/gin_tuple.h             |   44 + >> src/include/utils/tuplesort.h              |    8 + >> src/tools/pgindent/typedefs.list           |    4 + >> 9 files changed, 1937 insertions(+), 16 deletions(-) >> > > >