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 1tqf9J-008Vg0-TY for pgsql-committers@arkaria.postgresql.org; Fri, 07 Mar 2025 21:22:30 +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 1tqf9H-00HNxN-Ul for pgsql-committers@arkaria.postgresql.org; Fri, 07 Mar 2025 21:22:27 +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 1tqf9G-00HNxB-VM for pgsql-committers@lists.postgresql.org; Fri, 07 Mar 2025 21:22:27 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tqf9D-001Yz3-2J for pgsql-committers@lists.postgresql.org; Fri, 07 Mar 2025 21:22:26 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id E86EA11400F0; Fri, 7 Mar 2025 16:22:22 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Fri, 07 Mar 2025 16:22:23 -0500 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=fm3; t=1741382542; x=1741468942; bh=Mpzq8BttnLyDANVPD2eWdrMsHwq4KTRenMuQg6D8V1c=; b= L6EhPvniczVGd0KDE7ieFxkMVHx1DW4cdb3LOG8v+fKRVs5pcn0D2Ijv19Q2yfFP w943Caj7vQUW6gLm7BOyjIVSuw0CGrbDV0nS/MvCw2Vybq7zZ1VfH5PvNB6FYPe6 hnee0yB7EHeK6Tv6QXZGLFV2iBHjodTo2PqUSjJAY87460cgyBxooBwtICmqVYIH bFP/pU1/4kZBHKcTFcb+NofPKE59Likrp29OO+7DH8XkILwr9O7Qavk7Vb4ybz4t gdfuM9MBA+rM0pw3Lvpf5OjnYg9+eh7LdeLU8llTzeq/Ub6PmaOBRtzUw46xjE7Y SzIZSiFapeA6Li5m1EVyeA== 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=fm1; t=1741382542; x=1741468942; bh=M pzq8BttnLyDANVPD2eWdrMsHwq4KTRenMuQg6D8V1c=; b=0tZ1CuR0fvquA9Qhy nyGiZ5yakSzUh0+VlinWW6IhudrplfEGMEHuL3ySXMsjR7hCz8ixOruTSFl7qKQn wQ7+Yrk2MBiRC4BThjmJjZraDoW1Kk7JvK9pyMiH6NYmnl1nM7uuen+3FXOuhmSU YEfsB9RQwPMxOWGhH2Ept8moo6LrMy2cVQjv4h6mDlDzLdeUmU9xu8rBdZvYSRAe DpsivTgmr3R7Hy58N4mczrw5p0137zEBXks+uxZPQ43cWvEJiR7OciTqS5X+KETH wTw0OXctVuWMYuylzjrPGPwbL7TGI3kKMpxyE8BtVJtizUMRAWtAhyOVzxTcC4FB gY76g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduuddujedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddv jeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhesvghish gvnhhtrhgruhhtrdhorhhgqeenucggtffrrghtthgvrhhnpeelueevueevieevffeltdek ueffveevfffhjeduffevtdehieeljeeggfevfeevfeenucffohhmrghinhepphhoshhtgh hrrdgvshdpphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorh hgpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeht ohhmrghsrdhvohhnughrrgesphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepph hgshhqlhdqtghomhhmihhtthgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhr gh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Mar 2025 16:22:21 -0500 (EST) Message-ID: <35b1a8bd-5501-407f-b100-22f91834fcc8@eisentraut.org> Date: Fri, 7 Mar 2025 22:22:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Allow parallel CREATE INDEX for GIN indexes To: Tomas Vondra , pgsql-committers@lists.postgresql.org References: Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. 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(-) >