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 1lHUXz-0001ip-MQ for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Mar 2021 16:40:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lHUXx-0007iI-Pl for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Mar 2021 16:40:25 +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 1lHUXx-0007i5-Id for pgsql-hackers@lists.postgresql.org; Wed, 03 Mar 2021 16:40:25 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lHUXu-0002o0-Qs for pgsql-hackers@lists.postgresql.org; Wed, 03 Mar 2021 16:40:23 +0000 Received: by mail-pg1-x52c.google.com with SMTP id o38so16760180pgm.9 for ; Wed, 03 Mar 2021 08:40:22 -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=EFxQ9FhwK8CHWMN8nqtKRiXn7YFdYUT1GbgDgAPhTv0=; b=oMvnQJS7PjLsI+4p2U/aEfnliBd5xJEpEGKQkJZhD+dcVc/G75NrZSs/YWW6u7axSo nTqfGW3RxJLGdHPHQwz/i4Eb2vpyILpUUIBgiAROBOcz66xCsujQnjNp8CuZn6CR6qmE L3IohuoguvTHe3j2LL7uHDEUJcHwwHo/XaestZNot7GRVjsmyP4LTp+mPF/K1TCyvi5q mY2T9S5u+brsyoTldHb13D2GjbaAqM2Xd39BFPKubREeqgvmu6hw1dOOUDCMpu3bYUmq vQlYcSXg3yqI0fCkMb7P89TyG0g2IQmUhU8tW63nYn/f/cixzGOaaeenEfZBmZha5xSr Pd/Q== 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=EFxQ9FhwK8CHWMN8nqtKRiXn7YFdYUT1GbgDgAPhTv0=; b=W7zDY2W+ugBFbZHGHvR5SH79Yo9QCKIP3HAI0mNG/TreMAYOmLpWH+N0QZMluqXzN/ dA85b46oIO+Tc6iLu9avfXYh1cLEPlDiNQAw3bNOArr80GdqkdhEjkvE9cAXlStvpKlS O7fa5FQDd7Jm7RNwIMVRaaoZUBmy2iXXnofVjibjfj1Fq7GTZ0VH4kaKhH7U3mPxSDjl YMqwH4wqzCKbYStoxJkm9qO3zcu/MRNNInpEreD/drzh7hSSNEtfmoxBF5gZDnu3GclX jFvymjygwiRMretwoL3UJwJ+69UK2HxlUdPWYvOg1fMspJaHafy93701ezQL4qCOMgkG zp1g== X-Gm-Message-State: AOAM532nDbqpco1e1SjCKvrXfaj+akZbkz5d9AH3P4xYRMAs/qkgFshD i7CN5j/nc2HKfDWQ2yfgWDI= X-Google-Smtp-Source: ABdhPJwAwpMc5zV/oi8Shx0sUU6w7n0BzjjBwGejpeYY5b59+bNs0gR2I6XF9RVUeY3B6yPiX/iXXg== X-Received: by 2002:a65:4904:: with SMTP id p4mr24233572pgs.429.1614789621717; Wed, 03 Mar 2021 08:40:21 -0800 (PST) Received: from nol (2001-b011-0008-945f-8e19-0880-613b-abb9.dynamic-ip6.hinet.net. [2001:b011:8:945f:8e19:880:613b:abb9]) by smtp.gmail.com with ESMTPSA id b15sm23820046pgj.84.2021.03.03.08.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 08:40:21 -0800 (PST) Date: Thu, 4 Mar 2021 00:40:52 +0800 From: Julien Rouhaud To: Tom Lane Cc: Georgios , Julien Rouhaud , PostgreSQL Hackers , "robertmhaas@gmail.com" Subject: Re: Shared memory size computation oversight? Message-ID: <20210303164052.f336wina7qpchabd@nol> References: <20210227080815.jryyhy6lrn6gahkm@nol> <1183451.1614788634@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1183451.1614788634@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 03, 2021 at 11:23:54AM -0500, Tom Lane wrote: > Georgios writes: > > My limited understanding is also based in a comment in CreateSharedMemoryAndSemaphores() > > > * Size of the Postgres shared-memory block is estimated via > > * moderately-accurate estimates for the big hogs, plus 100K for the > > * stuff that's too small to bother with estimating. > > Right. That 100K slop factor is capable of hiding a multitude of sins. > > I have not looked at this patch, but I think the concern is basically that > if we have space-estimation infrastructure that misestimates what it is > supposed to estimate, then if that infrastructure is used to estimate the > size of any of the "big hog" data structures, we might misestimate by > enough that the slop factor wouldn't hide it. Exactly. And now that I looked deeper I can see that multiple estimates are entirely ignoring the padding alignment (e.g. ProcGlobalShmemSize()), which can exceed the 6kB originally estimated by Robert.