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 1rnj9e-00EkOj-OK for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Mar 2024 17:58:11 +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 1rnj9d-006Led-6n for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Mar 2024 17:58:09 +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 1rnj9c-006Le1-RQ for pgsql-hackers@lists.postgresql.org; Fri, 22 Mar 2024 17:58:09 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rnj9Z-005tUP-9k for pgsql-hackers@lists.postgresql.org; Fri, 22 Mar 2024 17:58:07 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33e1d327595so1801802f8f.2 for ; Fri, 22 Mar 2024 10:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711130285; x=1711735085; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EVRQafl6h2WFXY/q2E9fw7cBNB/9+rsJwEUO7dvm1NA=; b=L1jFTEhPLlAOfAqF7vJ/rHSAfnrAy32eHDZzuZMdxZmVrehcdx7eWKLyPnEkZ/iI4E U7iTJ6QaXNg8iaeVOI1/nq9bYuNHcIxD6B9pd6o0ituv99KOQCwEVk9EoQjWjxXrFlkH qYj0PrVjEl9Y2nXdXWLQb7DgqHAm388Im+wlEcWfk5MtZmt+JiLTPI9na5DW5VzLyczg u0nIdaObkDC3lyjFrhxCVgLGKbdnLRCjMt9y3XzNIDC50KaZgz3AFh2fZeS9qN6/XdWK FMRKsi/OuZ63NCET+4a2Hnj6vjv1APLtPvEb77qGMcUnzQySfltGKr84mv0resFTI5Z+ lkrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711130285; x=1711735085; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EVRQafl6h2WFXY/q2E9fw7cBNB/9+rsJwEUO7dvm1NA=; b=riiIgKub9LB3in+nSkY1FIk2Dbp6rRWLH5ogEMN9VzeypyshsFwjd6/H4P6KWn5lzI UZ2oEW5yamZUHnYP/NGlK0a3pFmWZRPSj6ogok7kW6gEXjm3cJqPs/LsXvBDlyIphtkD rO2BNDeZaV5bw2qj4T1JO/Q9aSz75N/pnIvRS1J8SAeUAcjXDy7XpdLTdnICKWQHtFuX zOj3qBMBTsf/JVVhhByuqR8YtWzWIh9QzQtDZ0ARZ+N2rIFgyBQeWrtbJ7sL50BeH4cU j1Naxva0tpXRsd+aY6Uelnrx8wvVq9hA/3lg98CQpeHYOmehR5JnJ1USVT3gPlZ5ZeqK zi/A== X-Forwarded-Encrypted: i=1; AJvYcCX+v+oTaR7Sd6TgXDXMHcI0lLLj6mmkuK5xYd5lpdW4p9iX6idOa6Yl/uRF7Qshdcyaf2NrBxBiyNUDqnpHrSuczmTVyJMpc0RvNBvMy7MuSk67 X-Gm-Message-State: AOJu0Yx3ij+HHsjHz2R7PPEXODcO8veGNNwrVwc+qWiCFiI4QrQYTmxZ Bx9EZMIgIkOeiv9n54GKSWS6tdUA5arjsINzEBOu9qE6UKYwG8qvPKRjZpIEiNy/uvD5g71sPbQ upQf5gay4d2pyTGBJ7vCOKdoC5bA= X-Google-Smtp-Source: AGHT+IHTAGBntWhY7rUdFnXnaJzwP0WnPCSqzzF2wK2VeF1BIpqek8+0NyMYmAJUGkYVPuOf4DvOudW/ZEwtJt5XUC4= X-Received: by 2002:a05:6000:104c:b0:33e:cf33:65bf with SMTP id c12-20020a056000104c00b0033ecf3365bfmr78190wrx.35.1711130284989; Fri, 22 Mar 2024 10:58:04 -0700 (PDT) MIME-Version: 1.0 References: <170509767861.1131.15083983626399995184.pgcf@coridan.postgresql.org> <17c31b30041187a577eb5b45090a58c5fae6418c.camel@crunchydata.com> <2c9d3664ff7adc506191f92db031543925abe0df.camel@crunchydata.com> In-Reply-To: From: Robert Haas Date: Fri, 22 Mar 2024 13:57:53 -0400 Message-ID: Subject: Re: [DOC] Add detail regarding resource consumption wrt max_connections To: Robert Treat Cc: reid.thompson@crunchydata.com, Roberto Mello , Cary Huang , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Mar 8, 2024 at 9:52=E2=80=AFAM Robert Treat wrote: > I'm of the opinion that advice suggestingDBA's set things to DEBUG 3 > is unfriendly at best. If you really want to add more, there is an > existing unfriendly section of the docs at > https://www.postgresql.org/docs/devel/kernel-resources.html#LINUX-MEMORY-= OVERCOMMIT > that mentions this problem, specifically: > > "If PostgreSQL itself is the cause of the system running out of > memory, you can avoid the problem by changing your configuration. In > some cases, it may help to lower memory-related configuration > parameters, particularly shared_buffers, work_mem, and > hash_mem_multiplier. In other cases, the problem may be caused by > allowing too many connections to the database server itself. In many > cases, it may be better to reduce max_connections and instead make use > of external connection-pooling software." > > I couldn't really find a spot to add in your additional info, but > maybe you can find a spot that fits? Or maybe a well written > walk-through of this would make for a good wiki page in case people > really want to dig in. > > In any case, I think Roberto's original language is an improvement > over what we have now, so I'd probably recommend just going with that, > along with a similar note to max_prepared_xacts, and optionally a > pointer to the shared mem section of the docs. I agree with this. I don't agree with Cary's statement that if you increase max_connections you should increase shared_buffers as well. That seems situation-dependent to me, and it's also missing Roberto's point, which is that JUST increasing max_connections without doing anything else uses more shared memory. Similarly, I don't think we need to document a detailed testing procedure, as proposed by Reid. If users want to know exactly how many additional resources are used, they can test; either using the DEBUG3 approach, or perhaps more simply via the pg_shmem_allocations view. But I think it's overkill for us to recommend any specific testing procedure here. Rather, I think that it's entirely appropriate to do what Roberto suggested, which is to say, let users know that they're going to use some extra resources if they increase the setting, and then let them figure out what if anything they want to do about that. --=20 Robert Haas EDB: http://www.enterprisedb.com