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 1lI3aB-0000sn-W3 for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Mar 2021 06:05:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lI3aA-0005ht-Tl for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Mar 2021 06:05:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lI3aA-0005hm-KX for pgsql-hackers@lists.postgresql.org; Fri, 05 Mar 2021 06:05:02 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lI3a4-0003fF-BW for pgsql-hackers@lists.postgresql.org; Fri, 05 Mar 2021 06:05:01 +0000 Received: by mail-pj1-x102a.google.com with SMTP id t9so1200879pjl.5 for ; Thu, 04 Mar 2021 22:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3CxttESPePcdXt1mZNsYM2tCKJb9wJ1/tmuIQi5fHS8=; b=ZKlnbV/puaKJ0G5o1qzaaBp+a+BiA+uUfkN2Ja6BDDXCIWB/1vk9eV+FoZrmFv7oYU a2dV8ItSZ3dfpv2UckoBGj80Ys0NMSYaQoL724GvQNAngvKIqp6frvIy6kNncEbR//WU Oi+dr8eqf6Kmm1WVrSJklAsmvTSWeTXn1yXBh1OQxAXHi7MrlVNQDfcNJxP1pGp5nqNa wzQGtAEbx0qCTAbHK1Px4YaALBq3XHGWdsm2ntt5OLcCi15BzLw7mYNVeVLuZYGeoqXo Sy6SXdFE+fwEQdIMH0FXWBw5zImIIO7sYAElfPtE8I9uxepKLpqju91+kZSfJNHzwSaJ 6Nrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3CxttESPePcdXt1mZNsYM2tCKJb9wJ1/tmuIQi5fHS8=; b=QeAeQdfJ/U25SP/8Geex5uODGuOXANTqUJRUWrT9LLJNg7gUTHojGX47hKzsdbJM/I qDLFJF0VlAQ5H6GGvS2I67zYDs+I6C5dDQMoL3NXlNUU337QaW2cf9EynaDMFx38iMl/ oxueC2EnbfEnLpfEsmgqdfowZ/Ontr9TAVS3uk7oFyPZyj/GzIe8ioMNtCTlgf4z8iC+ JlwARLiWjkd1QghfHE3HYGr68aqu9hvillniDQPXepnVLQviDbSElCs1FJLciHMOmpEh pYv+dBmBra6+fiWBtjW99mCfurpXL6aWWPo24sWFajWMgepUBRHePuEfdKhRu4dFqfwE gKQQ== X-Gm-Message-State: AOAM530P6nCbd12i2X2LWXJmj1fEeRrTbGKMaX9aDXQ+PcJxrXDjUT1M t7Jpf5htENYOUIQ3QVyOkGk= X-Google-Smtp-Source: ABdhPJyCInIu16WbgegqkFMCesmo3Cffv9ypZmgXDZAMlwvPPO/rxRgVEahMNAnXSx0qL0pGS8B3UA== X-Received: by 2002:a17:90a:ab8b:: with SMTP id n11mr8305467pjq.85.1614924295067; Thu, 04 Mar 2021 22:04:55 -0800 (PST) Received: from nol (2001-b011-0008-9697-4686-f9ea-c206-7335.dynamic-ip6.hinet.net. [2001:b011:8:9697:4686:f9ea:c206:7335]) by smtp.gmail.com with ESMTPSA id c11sm1162399pfl.52.2021.03.04.22.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 22:04:54 -0800 (PST) Date: Fri, 5 Mar 2021 14:05:22 +0800 From: Julien Rouhaud To: Tom Lane Cc: Georgios , Michael Paquier , Julien Rouhaud , PostgreSQL Hackers , "robertmhaas@gmail.com" Subject: Re: Shared memory size computation oversight? Message-ID: <20210305060522.5ogugff254szu5hf@nol> References: <20210227080815.jryyhy6lrn6gahkm@nol> <1183451.1614788634@sss.pgh.pa.us> <20210303164052.f336wina7qpchabd@nol> <20210304072333.4yydog47md7cfrda@nol> <1374257.1614880434@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1374257.1614880434@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 04, 2021 at 12:53:54PM -0500, Tom Lane wrote: > My conclusion is that we don't need to do anything, indeed the proposed > changes will probably just lead to overestimation. > > It's certainly possible that there's something amiss somewhere. These > numbers were all taken with out-of-the-box configuration, so it could be > that changing some postgresql.conf entries would expose that some module > is not scaling its request correctly. Also, I don't have any extensions > loaded, so this proves nothing about the correctness of any of those. > But it appears to me that the general scheme is working perfectly fine, > so we do not need to complicate it. Thanks for looking at it. I agree that most of the changes aren't worth the complication and risk to overestimate the shmem size. But I did some more experiments comparing the current version and the patched version of the lock and pred lock shared hash table size estimations with some configuration changes, and I find the following delta in the estimated size: - original configuration : 15kB - max_connection = 1000 : 30kB - max_connection = 1000 and max_locks_per_xact = 256 : 96kB I don't know if my version is totally wrong or not, but if it's not it could be worthwhile to apply the hash tab part as it would mean that it doesn't scale properly.