Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fcs80-0000JX-Hp for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Jul 2018 12:52:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fcs7y-0004xD-W8 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Jul 2018 12:52:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fcs7y-0004x6-GU for pgsql-hackers@lists.postgresql.org; Tue, 10 Jul 2018 12:52:22 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fcs7u-0003hm-UK for pgsql-hackers@postgresql.org; Tue, 10 Jul 2018 12:52:21 +0000 Received: by mail-wr1-x442.google.com with SMTP id m1-v6so1774504wrg.5 for ; Tue, 10 Jul 2018 05:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oM+5plfD9MnXJcXV0ZpN1x4q12NazLdkG44xILrexhY=; b=Cykc8fM5PcjNq4k0XySNJtbrMhwucoxDeJpZWgRNxyeo/JBB+s1U5tlD/JwA9YQU11 WqAGTi9pZo0y2K+mmXPqjaLRoKbRnU/4WPsIGB0II4kYfq7eyXtDRA5ZAxko6PxLTTBA MldHjOE3zzDjkdJQr2kHiW3flcP/DnEFzIYohhRBWwr3Rg3WQZ5mcx6mpcKQjTwEEeqF Glt6tBlaWXvRSYohDWFgZudmSlIUD6WPCvat8NrZX9eqK/e7DfAoS9s8JqarLC+0QVMu dP4noZZft3Cpxt+oBFxv5zpForcnQ0uQ07Tyg1UQvj3GVMdiCqFwu9SH51mD6vi0XtDJ Y6pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oM+5plfD9MnXJcXV0ZpN1x4q12NazLdkG44xILrexhY=; b=eNGBoc0AhD5Im2UvpFtWOqkpmtmBaXK8HJH7NJcXx/3M1aY3H7MGI9Aj/KV47WKQxy MqQb9JaqdTpeE4T8HfAAaCFz1Vx9bvSQsOSVz3103dG+qIuiEVhczWgSncHbVFDj2sBe Ti6tOKNwCHFTTo/zyR0GejOwXJqa1IJZPAzqNyTHJqrroKZRUz2DW/zLwXuma64sYhGU oDlsBCHYPPwwKdw45RqAtNEPEQ8oG6/vXl7ypj+tFdEBvlMoNVMvRoupngtwDRnhhj9l 5tm+XJJgHx1MB0PNtDaZp+TlqHMURrz37Wa7r5/88XeUfTRn8lgvXwmHljDwi2IID7/y 2EAA== X-Gm-Message-State: APt69E19zkAEKcV1wG5+wj7fI9Duq/lfQ6mTMRUDin2cDVGRdJTqLOvP otvZc3R+1fWEDfSb8dFQvAsq+y+YJOXY7GmzmYeLZM7F81siJQGvWR76zsBLCsexStAOtAQm2zQ 4AQuJeHEcgZONWSLeWigD2aleJsIQD6wfzYJqLynYs0K2Aa2SSlNUEFdtXNfIsTcSfxhlCIwwP1 AKmnDXf8yp X-Google-Smtp-Source: AAOMgpdEo+KJcBZusLXHN4wKz96N+TiN289n+00v0xMO8nJcZSCPiQWQgmDCAuEnuXkfQUwSr8JgiQ== X-Received: by 2002:adf:a015:: with SMTP id k21-v6mr17044633wrk.202.1531227136948; Tue, 10 Jul 2018 05:52:16 -0700 (PDT) Received: from [10.137.2.21] (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id v25-v6sm13727943wmh.43.2018.07.10.05.52.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 05:52:16 -0700 (PDT) Subject: Re: shared-memory based stats collector To: Kyotaro HORIGUCHI , andres@anarazel.de Cc: magnus@hagander.net, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org References: <20180706185750.b6h5cwif53zfieu7@alap3.anarazel.de> <20180706201036.awheoi6tk556x6aj@alap3.anarazel.de> <20180710.210740.66209890.horiguchi.kyotaro@lab.ntt.co.jp> From: Tomas Vondra Message-ID: <2a8de8bb-dbb8-3b21-9364-6a1b45916731@2ndquadrant.com> Date: Tue, 10 Jul 2018 14:52:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180710.210740.66209890.horiguchi.kyotaro@lab.ntt.co.jp> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07/10/2018 02:07 PM, Kyotaro HORIGUCHI wrote: > Hello. Thanks for the opinions. > > At Fri, 6 Jul 2018 13:10:36 -0700, Andres Freund wrote in <20180706201036.awheoi6tk556x6aj@alap3.anarazel.de> >> Hi, >> >> On 2018-07-06 22:03:12 +0200, Magnus Hagander wrote: >>> *If* we can provide the snapshots view of them without too much overhead I >>> think it's worth looking into that while *also* proviiding a lower overhead >>> interface for those that don't care about it. >> >> I don't see how that's possible without adding significant amounts of >> complexity and probably memory / cpu overhead. The current stats already >> are quite inconsistent (often outdated, partially updated, messages >> dropped when busy) - I don't see what we really gain by building >> something MVCC like in the "new" stats subsystem. >> >> >>> If it ends up that keeping the snapshots become too much overhead in either >>> in performance or code-maintenance, then I agree can probably drop that. >>> But we should at least properly investigate the cost. >> >> I don't think it's worthwhile to more than think a bit about it. There's >> fairly obvious tradeoffs in complexity here. Trying to get there seems >> like a good way to make the feature too big. > > Agreed. > > Well, if we allow to lose consistency in some extent for improved > performance and smaller footprint, relaxing the consistency of > database stats can reduce footprint further especially on a > cluster with so many databases. Backends are interested only in > the residing database and vacuum doesn't cache stats at all. A > possible problem is vacuum and stats collector can go into a race > condition. I'm not sure but I suppose it is not worse than being > involved in an IO congestion. > As someone who regularly analyzes stats collected from user systems, I think there's certainly some value with keeping the snapshots reasonably consistent. But I agree it doesn't need to be perfect, and some level of inconsistency is acceptable (and the amount of complexity/overhead needed to maintain perfect consistency seems rather excessive here). There's one more reason why attempts to keep stats snapshots "perfectly" consistent are likely doomed to fail - the messages are sent over UDP, which does not guarantee delivery etc. So there's always some level of possible inconsistency even with "perfectly consistent" snapshots. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services