Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lD2Jn-0004Jc-T2 for pgsql-general@arkaria.postgresql.org; Fri, 19 Feb 2021 09:43:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lD2Jm-0002Vz-OC for pgsql-general@arkaria.postgresql.org; Fri, 19 Feb 2021 09:43:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lD2Jm-0002Vr-Ar for pgsql-general@lists.postgresql.org; Fri, 19 Feb 2021 09:43:22 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lD2Jj-0007WO-FF for pgsql-general@lists.postgresql.org; Fri, 19 Feb 2021 09:43:21 +0000 Received: by mail-ed1-x530.google.com with SMTP id g3so8625994edb.11 for ; Fri, 19 Feb 2021 01:43:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=7V3z6GZ2EmtKaULB493KCvldhbTPhFWXASmPzfnUXHU=; b=sSKbna+pyLqhMQil3LH3AstCYcjGesI8swsSP5n6H5zlZLB9YqWaQUiO4zmRhFn/9x G2vVpC2vhsh0qMnC7LGr834nOom5J+i8xOrpXDHU9nM+T4+mVHUKmnkur8B2fYOzI16G POqc0DY2Q6rGNvmQRejoRpvItjd1hasL6y3u0fmIxfsooArukIqakDEtQE66pDWJGOMr E68rQw4bpGOTvv4qyJW0X6SYMA+n8VxQNKQb0PqI8zsG6cx2oxzXEUfiBTKYg5f1DZeY ylnpcaRDEq8iE73zwBtaFM3A+NG+xHRVag6tGG+Bt9+dCe8EPkBX3WaFkR46bDGanrtm yUYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=7V3z6GZ2EmtKaULB493KCvldhbTPhFWXASmPzfnUXHU=; b=pAFPl/YJ4ZmnaNYwizM3k1mgbjnv1fqK1fTAUCBQ+dT+U+bOwqmlDGA3JjXIV9y8mU ghznQJiz3cvZU5PuDpnjy7OuumfJ5s3MCdD+4qVHBnj6ut4xfc5EXtFsCAUMKygLah9F 0gaAod1t08ki+tmHGRF52DuVBlbZR8KQXpDYMnkMKpuISmAt3IpXPb+5aZpIuYt1+e43 A7ykdA0wDVHwHXMhNYcVBgxGKhyaueIVaaNAyjl4Egzi58+Y+SHTv2lo3E48WFZ6ELP/ y9qW7HXKrz7UpKrTYcAOoBBDH56W+L5IphT423wpiqoMF+WWriNQCNrH+0LtqVYHDz/w F1Jg== X-Gm-Message-State: AOAM5338TQZwjpHkhjvniF1EcToZBB0+wLl/cAIDZrVoO0U367X2499y O3nkvdF58bbTiYwsCmFe0nZ6iA== X-Google-Smtp-Source: ABdhPJz0u/dsmckOhxUonIv025sKswGmQPdPQZarcpGFHnI1X8ElQjN8N8YHGEiGVWoAbBZIFF6f7Q== X-Received: by 2002:aa7:d6cf:: with SMTP id x15mr8083323edr.338.1613727798571; Fri, 19 Feb 2021 01:43:18 -0800 (PST) Received: from localhost.localdomain (217-149-173-224.nat.highway.telekom.at. [217.149.173.224]) by smtp.gmail.com with ESMTPSA id x17sm4135243eju.36.2021.02.19.01.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 01:43:18 -0800 (PST) Message-ID: Subject: Re: how does PostgreSQL determine how many parallel processes to start From: Laurenz Albe To: Luca Ferrari , pgsql-general Date: Fri, 19 Feb 2021 10:43:17 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, 2021-02-19 at 10:38 +0100, Luca Ferrari wrote: > I know that parallel processes can be limited by > max_parallel_workers_per_gather and max_parallel_workers, as well as > the condition to consider a parallel plan is min_table_scan_size (and > index). But I would like to understand, once a table has been > considered for a parallel plan, and there is room for other workers, > how will PostgreSQL decide to start another process? During planning, it will generate parallel and non-parallel plans and take the one it estimates to be cheapest. At execution time, PostgreSQL will use as many of the planned workers as are currently available (max_parallel_workers). Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com