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 1s6Rq0-00C00X-5n for pgsql-hackers@arkaria.postgresql.org; Mon, 13 May 2024 09:19:16 +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 1s6Rpy-00Gjmq-ED for pgsql-hackers@arkaria.postgresql.org; Mon, 13 May 2024 09:19:14 +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 1s6Rpy-00Gjmi-4D for pgsql-hackers@lists.postgresql.org; Mon, 13 May 2024 09:19:14 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s6Rpv-000mUC-HY for pgsql-hackers@lists.postgresql.org; Mon, 13 May 2024 09:19:12 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a59b097b202so867332766b.0 for ; Mon, 13 May 2024 02:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1715591949; x=1716196749; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oyJs1g4T6jsr27YHWd+CuACtHAgKV15SW80QhoihEII=; b=Cme8AUAft5eFgp/A1yCwndZEytC6Zo8W7VjSdoN3apC/uXFiDA2R9ujmryS6RUAb+9 QK+hlqE8wygg9pLYqvjQcjmCkoSgsfEFT6L8Ke9cDthahavZTQ+h9i6ind1LasOD1rd2 aey6IptdlSTPSsUMZA8FNkcEKR/UfPJV7YgV77lroxDyrcVfR4W37Nst4c10hWY6dQz4 KqGq+IJACpQC0PPxhUgyisZnwmsjr/vIvqzoin5T1NZ+MqMFZ4GlzWwJOgPg/DjRKq2K f1MyPAfUIC1TLHKER0D7XYVI3BbHSKrRNF+ahQdXpxDfyt73nX+K44AI3tjy8L2Rw/hD PEbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715591949; x=1716196749; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oyJs1g4T6jsr27YHWd+CuACtHAgKV15SW80QhoihEII=; b=GP/oXcWrAWnxg6BDuzEuWbc18Ml0I4VEWPWgNo2NY3oXMTP+Lle0lfk04FDLFzUc3g kBv1st7070lKZsEZ3WGwmzbjkhMD/pNtr9Rh6xx5axs1DWMRWNveiLpozbTyMHTE46Zv VjbSXaKxqWxxKoipDCkZZ43JE2A4aTHwR2wd6ZNskPVklMCMBMhQLgEkEk6jjqUjg/i9 7lESmCyJsiM24C1ZHlMqkLdrhcDVumlUZ6dkvmviZ7743JRUIe40Auuk2Dl0tvvbfH99 TiSy1yo57xpPUw+ZT3Lw7Vzpu5qaNfDxRCNmi0knqEzX8TsHJHP34LLuNonGGGxqJiR1 p26A== X-Gm-Message-State: AOJu0YwN0TTHI6Ncz5nntwWE8F/0bquvdSQkEaYA24b3WzWwADxNFNgI SLxZAIsDx8/XXNlu6djec3vtG4ekmapjgM1opgI//k8bTHfpRn5BDGA9D2LSgg== X-Google-Smtp-Source: AGHT+IHyPEdfmPUuTkNa+d9D7KEZ1sfbDSx6LK0ZC7DEHqf87ys9aGvLhllPqHBnLZQKftkUDiBDOQ== X-Received: by 2002:a17:906:1293:b0:a59:bde5:398 with SMTP id a640c23a62f3a-a5a2d536c98mr617680366b.14.1715591949147; Mon, 13 May 2024 02:19:09 -0700 (PDT) Received: from [10.137.0.18] (ip-86-49-229-30.bb.vodafone.cz. [86.49.229.30]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c7e02sm566753866b.105.2024.05.13.02.19.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 May 2024 02:19:08 -0700 (PDT) Message-ID: Date: Mon, 13 May 2024 11:19:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Parallel CREATE INDEX for GIN indexes To: Andy Fan Cc: pgsql-hackers@lists.postgresql.org References: <6ab4003f-a8b8-4d75-a67f-f25ad98582dc@enterprisedb.com> <87pltvmgdm.fsf@163.com> <3b721981-6fa3-4698-a9b6-70b2d8e8fa3b@enterprisedb.com> <87y18ektdn.fsf@163.com> Content-Language: en-US From: Tomas Vondra In-Reply-To: <87y18ektdn.fsf@163.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/13/24 10:19, Andy Fan wrote: > > Tomas Vondra writes: > >> ... >> >> I don't understand the question. The blocks are distributed to workers >> by the parallel table scan, and it certainly does not do that block by >> block. But even it it did, that's not a problem for this code. > > OK, I get ParallelBlockTableScanWorkerData.phsw_chunk_size is designed > for this. > >> The problem is that if the scan wraps around, then one of the TID lists >> for a given worker will have the min TID and max TID, so it will overlap >> with every other TID list for the same key in that worker. And when the >> worker does the merging, this list will force a "full" merge sort for >> all TID lists (for that key), which is very expensive. > > OK. > > Thanks for all the answers, they are pretty instructive! > Thanks for the questions, it forces me to articulate the arguments more clearly. I guess it'd be good to put some of this into a README or at least a comment at the beginning of gininsert.c or somewhere close. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company