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 1ncgUO-0004He-Mk for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Apr 2022 04:44:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ncgUN-0008Ae-AX for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Apr 2022 04:44:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ncgUN-000880-0q for pgsql-hackers@lists.postgresql.org; Fri, 08 Apr 2022 04:44:51 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ncgUK-0002Fw-RI for pgsql-hackers@lists.postgresql.org; Fri, 08 Apr 2022 04:44:50 +0000 Received: by mail-pg1-x52c.google.com with SMTP id k14so6838393pga.0 for ; Thu, 07 Apr 2022 21:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=kGxTrsYlnyp76kVqXmZyciyTvJcxije4Ah7LFMyCxbw=; b=ZtgHiQSrbtM8rIGjvwV/KUbpDSV5xv+gCpT0EpbmMEMTWWw1tdKeLJiCQi8yz9Nji5 do3m8c58ZNVdiT6LBK9JePJomnDdhURx9/PrRs4qIUD9m5kav4ueDs8uqAQnK4UcfbGr bmzxEAO53fa1Ejoo1SFsJd1nOppiijjeW63wJeAS88No4YTlnctItNxsNFEJvaODoe5U d2oUDlQpCBD+Iv1c5YOuizW51X11msQZMU3I6wnNLkiBDJa4dQLCUTyX17pC31vLjJN8 u9cG78Xr04ihP8X4qZqKI3D39rcOtvTTg52b1dPaJdAK6mGfYHyyE/m6HnD0L1G+Aa60 nvdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=kGxTrsYlnyp76kVqXmZyciyTvJcxije4Ah7LFMyCxbw=; b=QeNghfvgElfTK3ZVq5FdinZ1qjFzD9kpe2HQM7z13JU6AGsqexJ3yEq5WIJ9hGdcIx TcsLIpuFMZPcn5Rnj9vh0q4M2cQP0E4r466iZv7dKx22cZZitV/0md9YmYylVjpFo+9q LXXhdL8Tnn2EuEMpppoUGlILoIJAoHqts3tIlJSMnirJDyKcxFD9tkSM7yaXWsUNCaaj DHpyZJcRN5MTjOHsPDXIFBnTJygz7Oe3yTv7nBLfnohgsFWmIglH0an3SCk4w+gHQKWi rpyb19ughFCeKQQJosH+CNmyhgLK0vermhulLkmxhp3gZoC82gZH8/ITqQwpFxifllDh Zjdw== X-Gm-Message-State: AOAM530W9L9O0GnCeyzSCFQwXge9NziAT5zTowKWza8TFExcKUQGoXiQ n9giHaCBmmmI/qofd9bmnU0= X-Google-Smtp-Source: ABdhPJyb4B//Kh9WUh/RLvMeV1EPQpNLJ1nVHEZccrLbzNjE6MjZ/Mxp0uEEIXJAKG+a0q3lSNzzxg== X-Received: by 2002:a05:6a00:8c5:b0:4fe:134d:30d3 with SMTP id s5-20020a056a0008c500b004fe134d30d3mr17689522pfu.3.1649393086432; Thu, 07 Apr 2022 21:44:46 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id f19-20020a056a00229300b004fb157f136asm25107815pfe.153.2022.04.07.21.44.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Apr 2022 21:44:45 -0700 (PDT) Date: Fri, 08 Apr 2022 13:44:43 +0900 (JST) Message-Id: <20220408.134443.298969491538816073.horikyota.ntt@gmail.com> To: andres@anarazel.de Cc: melanieplageman@gmail.com, pryzby@telsasoft.com, thomas.munro@gmail.com, david.g.johnston@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: shared-memory based stats collector - v70 From: Kyotaro Horiguchi In-Reply-To: <20220408035921.xlmjrv7wdmk3xm7k@alap3.anarazel.de> References: <20220407233751.i573vgmuwicphd2t@alap3.anarazel.de> <20220408.111014.1139039683831064200.horikyota.ntt@gmail.com> <20220408035921.xlmjrv7wdmk3xm7k@alap3.anarazel.de> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Thu, 7 Apr 2022 20:59:21 -0700, Andres Freund wrote in > Hi, > > On 2022-04-08 11:10:14 +0900, Kyotaro Horiguchi wrote: > > I can read it. But I'm not sure that the difference is obvious for > > average users between "starting a standby from a basebackup" and > > "starting a standby after a normal shutdown".. > > Yea, that's what I was concerned about. How about: > > > Cumulative statistics are collected in shared memory. Every > PostgreSQL process collects statistics locally > then updates the shared data at appropriate intervals. When a server, > including a physical replica, shuts down cleanly, a permanent copy of the > statistics data is stored in the pg_stat subdirectory, > so that statistics can be retained across server restarts. In contrast, > when starting from an unclean shutdown (e.g., after an immediate shutdown, > a server crash, starting from a base backup, and point-in-time recovery), > all statistics counters are reset. > Looks perfect generally, and especially in regard to the concern. > I think I like my version above a bit better? Quite a bit. It didn't answer for the concern. > > > 2) > > > The edit is not a problem, but it's hard to understand what the existing > > > paragraph actually means? > > > > > > diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml > > > index 3247e056663..8bfb584b752 100644 > > > --- a/doc/src/sgml/high-availability.sgml > > > +++ b/doc/src/sgml/high-availability.sgml > > > @@ -2222,17 +2222,17 @@ HINT: You can then restart the server after making the necessary configuration > > > ... > > > > > > - The statistics collector is active during recovery. All scans, reads, blocks, > > > + The cumulative statistics system is active during recovery. All scans, reads, blocks, > > > index usage, etc., will be recorded normally on the standby. Replayed > > > actions will not duplicate their effects on primary, so replaying an > > > insert will not increment the Inserts column of pg_stat_user_tables. > > > The stats file is deleted at the start of recovery, so stats from primary > > > and standby will differ; this is considered a feature, not a bug. > > > > > > > > > > > > > Agreed partially. It's too detailed. It might not need to mention WAL > > replay. > > My concern is more that it seems halfway nonsensical. "Replayed actions will > not duplicate their effects on primary" - I can guess what that means, but not > more. There's no "Inserts" column of pg_stat_user_tables. > > > > The cumulative statistics system is active during recovery. All scans, > reads, blocks, index usage, etc., will be recorded normally on the > standby. However, WAL replay will not increment relation and database > specific counters. I.e. replay will not increment pg_stat_all_tables > columns (like n_tup_ins), nor will reads or writes performed by the > startup process be tracked in the pg_statio views, nor will associated > pg_stat_database columns be incremented. > Looks clearer since it mention user-facing interfaces with concrete example columns. regards. -- Kyotaro Horiguchi NTT Open Source Software Center