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 1s54lJ-00308y-KH for pgsql-hackers@arkaria.postgresql.org; Thu, 09 May 2024 14:28:45 +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 1s54lH-007oPR-PP for pgsql-hackers@arkaria.postgresql.org; Thu, 09 May 2024 14:28:44 +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 1s54lH-007oPH-Ex for pgsql-hackers@lists.postgresql.org; Thu, 09 May 2024 14:28:43 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s54lD-000CFj-7p for pgsql-hackers@lists.postgresql.org; Thu, 09 May 2024 14:28:42 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a5a157a1cd1so224554866b.0 for ; Thu, 09 May 2024 07:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1715264917; x=1715869717; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=3HIcP8T3sJWvLHcRC57zs+f2CaEFTbBYOCre2i4VE5A=; b=ip4KcfqcwMx8feJyDIrzQ0Mki2XJE9jZFdLDX2ktDAGbvxEGXyW7Ll02/qjSmmliJd OwzZphGQww4VA33Hb3lA3zCxsbEQEBHSRlBCSKgW/+2T2+TAJI+Usrt/9aqf++CEOQF+ CE2WBUIqzRRTrVbIEzpYqI1IaU8m+uRnmm7MQ4vje78pa4hZxkIaJcJsup+cvqMsAKZI rANeAR+rGU97ZHxgyg3Pad4YlQpATlqa/EXQNTqEbez7J3H0xarxWwgUKDco3rp2Xk70 iMf33Ka3QfsVGoqafTteiewOHzNQM9D6vEKfgyDUOlwVItM4l4lSmM700hTA7psMpa2x wa9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715264917; x=1715869717; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3HIcP8T3sJWvLHcRC57zs+f2CaEFTbBYOCre2i4VE5A=; b=pqbIEtZc8rjE3WqK9S2pGvyWaCvGJNuR/BiUguTIKLR0udDwew483F2B+WtwCNWfZJ dQHKPdQcxpYTyqIJ0zNamJKmsKuuV0pNwiNw4a+Rv1l/HSzHwYN+rJjMpGEgOw1yJYVy TGwm9aCq+FptSj/+Sl20DRl/0ZoRhQ0oeCpv47AbPt0kxmXJwzYirW/l3IHxIduo49Wm jZiSStKpFEvOz6sIiRZLjLkTk69yi1nYy6NMlA19n47zqy426Yu/PiCVn362NC7N41pd b+rpR+sfBYKnyklca1h/KIJfbKWZY7YHUDnFnAfL6+yFUtAm25Y2ndAQKfiB33M06yig D40g== X-Gm-Message-State: AOJu0YxdspuP3DVu5PvCxaKBaLHWljh82xfkYGOKlUOw3k7AfY9OVnLm tiQcq3PAuxxjWZKYiyg18JCdWr2xBCIT6Thyc0lHrK2kSP4AUMOTmupLJYGVEkDFGYnuqOlKMK8 = X-Google-Smtp-Source: AGHT+IHw5KcrrbMhRqyw1dwXoBilM7nldTNJB92lcmVRgbgDj2FrAzdUX+JpPFMfCToCKp7C7kV2vg== X-Received: by 2002:a17:906:f28c:b0:a59:a0eb:aeb0 with SMTP id a640c23a62f3a-a59fb952bb0mr387710366b.36.1715264917345; Thu, 09 May 2024 07:28:37 -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-a5a179c7d09sm79560466b.107.2024.05.09.07.28.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 May 2024 07:28:37 -0700 (PDT) Message-ID: Date: Thu, 9 May 2024 16:28:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Parallel CREATE INDEX for GIN indexes From: Tomas Vondra To: Matthias van de Meent Cc: PostgreSQL Hackers References: <6ab4003f-a8b8-4d75-a67f-f25ad98582dc@enterprisedb.com> <5b5a059d-0699-4cc2-b9a0-32053ea19a65@enterprisedb.com> Content-Language: en-US In-Reply-To: <5b5a059d-0699-4cc2-b9a0-32053ea19a65@enterprisedb.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/2/24 20:22, Tomas Vondra wrote: >> >>> For some of the opclasses it can regress (like the jsonb_path_ops). I >>> don't think that's a major issue. Or more precisely, I'm not surprised >>> by it. It'd be nice to be able to disable the parallel builds in these >>> cases somehow, but I haven't thought about that. >> >> Do you know why it regresses? >> > > No, but one thing that stands out is that the index is much smaller than > the other columns/opclasses, and the compression does not save much > (only about 5% for both phases). So I assume it's the overhead of > writing writing and reading a bunch of GB of data without really gaining > much from doing that. > I finally got to look into this regression, but I think I must have done something wrong before because I can't reproduce it. This is the timings I get now, if I rerun the benchmark: workers trgm tsvector jsonb jsonb (hash) ------------------------------------------------------- 0 1225 404 104 56 1 772 180 57 60 2 549 143 47 52 3 426 127 43 50 4 364 116 40 48 5 323 111 38 46 6 292 111 37 45 and the speedup, relative to serial build: workers trgm tsvector jsonb jsonb (hash) -------------------------------------------------------- 1 63% 45% 54% 108% 2 45% 35% 45% 94% 3 35% 31% 41% 89% 4 30% 29% 38% 86% 5 26% 28% 37% 83% 6 24% 28% 35% 81% So there's a small regression for the jsonb_path_ops opclass, but only with one worker. After that, it gets a bit faster than serial build. While not a great speedup, it's far better than the earlier results that showed maybe 40% regression. I don't know what I did wrong before - maybe I had a build with an extra debug info or something like that? No idea why would that affect only one of the opclasses. But this time I made doubly sure the results are correct etc. Anyway, I'm fairly happy with these results. I don't think it's surprising there are cases where parallel build does not help much. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company