Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGMmK-0006XN-L3 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2019 12:33:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGMmJ-0000rK-A3 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2019 12:33:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGMmI-0000r6-Qh for pgsql-hackers@lists.postgresql.org; Fri, 04 Oct 2019 12:33:47 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iGMmF-0001mc-NA for pgsql-hackers@postgresql.org; Fri, 04 Oct 2019 12:33:45 +0000 Received: by mail-lj1-x242.google.com with SMTP id 7so6327000ljw.7 for ; Fri, 04 Oct 2019 05:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0PEUT8+wRFcK3aYhrLGrQFLh0NbVE35Sv59f2U6M314=; b=iIC6AZqzHJ/biaB/lll9ZrRPol4/cZkjT1Wj+2RIbSswb2x9xMLsGcRwtJIoZ22CX5 pcTDXgsUkSuGyJo8zYyqUxqJgFFgBQc02YdiYUKTnONkVHh+De/vUzq68knd92B748Kg B/eWSMYeE9q1t1GnfZMdHh7Hj06MLFqb62vve8e3+jmwvz7QNTFPIpRinXA6n/AOIHDD KBA4VdS2CjEqRJbh3ef7aQnS00MzKAV91vZ5xW0hOOFkTTV7vjfoMc3ntkGv4MtMemCy UWj4RYWpBRc3NXZezvWY8jCiiqcs3aLjcpKuM9QC4EYhyqwQ3dPHirGQ9TQNk2A/v4F+ qD3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0PEUT8+wRFcK3aYhrLGrQFLh0NbVE35Sv59f2U6M314=; b=c4TR6wZFxujJB73deDopCNObTSlV1s2c0KqfZ73z4GSUpIIzPtrzSaczfU2ojrbQCI xqpV3ciFXNVzz3at9r049scGaxX+f7ygMnFxUPNslJNzRWEh/j3CSRBD8n6OgVW+JRcY 69lZQGnck7Ed/TfMZiy/OTbsOdhmtxhQ1UlEbT559c7U/hciAgH1+7nkvaj8VY+Rq0EY Z89TnPAQsipb3ht+5a+miQPF5EVCgFeh3cyK/8jo2tFYIzGeyc31kis9fT3kG1PubbrB Gxt4p/V9dg7Hu4L4DwrmAGNQZKuPAoGY+ITdhC8FVcohUAoGDotATE4fd0DTJwVBnAZ6 IQwA== X-Gm-Message-State: APjAAAVQC3LVOWQo9gdRvfbtAKZBz6bpA7pqlS9BAWACqZXIFp9k8oLa QpycgvQ9xazD6T5lQtbxdGLOXJAp+ziSomB7lK+uLw== X-Google-Smtp-Source: APXvYqw2MC/GUNCrqYHW7O4Nw1eOjFuzzdeMJe7vmBEmfMw7cOmkicwf/nPLfL2b+8gUHABEj9X7zg6NLZk9ZYj1wjc= X-Received: by 2002:a2e:2bda:: with SMTP id r87mr9401807ljr.3.1570192422115; Fri, 04 Oct 2019 05:33:42 -0700 (PDT) MIME-Version: 1.0 References: <4315675a0ea69af857d282f35072254ee73c61d6.camel@j-davis.com> In-Reply-To: <4315675a0ea69af857d282f35072254ee73c61d6.camel@j-davis.com> From: Robert Haas Date: Fri, 4 Oct 2019 08:33:30 -0400 Message-ID: Subject: Re: max_parallel_workers question To: Jeff Davis Cc: "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Sep 28, 2019 at 1:36 PM Jeff Davis wrote: > In that case, PGC_SIGHUP seems most appropriate. Yeah. > It also might make more sense to rename it to reserved_worker_processes > and invert the meaning. To me, that would be more clear that it's > designed to prevent parallel query from interfering with other uses of > worker processes. I don't think that would work as well. Some day we might have another class of worker processes with its own independent limit, and then this terminology would get confusing. It makes sense to say that you can have up to 10 worker processes of which at most 4 can be used for parallel query and at most 3 can be used for logical replication, but it doesn't make nearly as much sense to say that you can have up to 10 worker processes of which 6 can't be used for parallel query and of which 7 can't be used for logical application. That leaves, uh, how many? > Another option would be to make it two pools, one for parallel workers > and one for everything else, and each one would be controlled by a > PGC_POSTMASTER setting. But it seems like some thought went into trying > to share the pool of workers[1], so I assume there was a good reason > you wanted to do that. Here again, I imagine that in the future we might have various different worker classes that need to share the total number of workers, but not necessarily via a hard partition. For example, you could sensible say that there are 3 purposes for workers and 10 workers, and no single purpose can consume more than 4 workers. Even though 4 * 3 > 10, it's a completely reasonable configuration. The early bird gets the juiciest worm, and the late bird doesn't starve to death. Even a more extreme configuration where you limit each purpose to, say, 7 workers could be reasonable. Here there is a risk of starvation, but you may know that in your environment it's not likely to last for very long. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company