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 1ph2Ee-00016r-T7 for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 05:51:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ph2Ed-000616-Eo for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 05:51:07 +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 1ph2Ed-00060x-3s for pgsql-hackers@lists.postgresql.org; Tue, 28 Mar 2023 05:51:07 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ph2EZ-0006l6-8g for pgsql-hackers@lists.postgresql.org; Tue, 28 Mar 2023 05:51:05 +0000 Received: by mail-wm1-x32c.google.com with SMTP id t17-20020a05600c451100b003edc906aeeaso220319wmo.1 for ; Mon, 27 Mar 2023 22:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679982662; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TnMAhgei8bxmlzidpG7XVaDmc3SQjKsi3jh9Tt6M5oU=; b=JJUmyVd7P4o612I9Q2CQLphGZNL+fLP/yax3oTkxMqqmx7mKRbsh1OmPPSrgl3jsJc iXGjLzlieOVu9OBgrOYxMGx8vJakuf+3aS5tqk4MxpZcGvfRHOWNM+Nn2EdMxdW1m75t +Ak7B2CIcgHAH3ittjwLM+Ujx269EthbpSRXhCnxGrjGW2WiutCFqv+Gs0sGzIwuo8Nv A9yE0Ggw5MGNpeRJlw1/3cqWczq+Q1mLKaJUrtD0ybYIwVHQNzsPLDirbJYSJoUSrs3H XLGL8o5WTBap5zRK/YuotmjMDeI921vm48+8jmTerSMClvDFzwN+OXcsv5sV9XOMkBoJ skKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679982662; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TnMAhgei8bxmlzidpG7XVaDmc3SQjKsi3jh9Tt6M5oU=; b=XHGssw+ZHQyD4P3pgRYva9quGD8eXWeXHUzWgRCoFLiukLP6KzX2yYJ0SqdfnwWkYb yZf0DDnl5SVL56SkGueCLJ8GuS32YLz90PFXaGUoSfSxBd/G9u6srSe6ARWXIJr22J/b UhzX3hTF2w6LrT4ClNS2cZWAeekkB8tX8LGZN43DBhQn1UgYxUNDw/UliqGS9A3rVHZf u8GHLPZTKPISSmevQjIZ3cUzNb5rTOuxoa4G6/fw50G3Df7LZFiySNF5QS2CbEj9rpO2 LgDJUgrNxId05wnF8SzkejDFhYdKKiFy2Nl3ae0tdykA2EErkN3Y+zmznL+2+Q1Zp+/3 tyHQ== X-Gm-Message-State: AO0yUKV/olZAKmQ3wLtQg2ru118y3K/iVdhLHcj9aywXaxFhrpnMKCxu yjgJrEyr/ralHK46aJkIGZY= X-Google-Smtp-Source: AK7set/rYMS4hIkaErYW2k6FJBNkN8O40pEW+2su+gkwSXD9fGrlIPfBfRDYH5qryl9kJcg0K0siSg== X-Received: by 2002:a1c:f60f:0:b0:3ed:90b2:60c6 with SMTP id w15-20020a1cf60f000000b003ed90b260c6mr11266145wmc.19.1679982661677; Mon, 27 Mar 2023 22:51:01 -0700 (PDT) Received: from [192.168.6.242] ([54.239.6.188]) by smtp.gmail.com with ESMTPSA id f24-20020a7bc8d8000000b003eb596cbc54sm15956495wml.0.2023.03.27.22.51.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Mar 2023 22:51:01 -0700 (PDT) Message-ID: <32cd9a82-9221-f081-87d4-1f4fa6359a4d@gmail.com> Date: Tue, 28 Mar 2023 07:49:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry Content-Language: en-US To: Michael Paquier , Kyotaro Horiguchi Cc: melanieplageman@gmail.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org References: <20230328.123615.1049160234680207474.horikyota.ntt@gmail.com> From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 3/28/23 7:23 AM, Michael Paquier wrote: > On Tue, Mar 28, 2023 at 12:36:15PM +0900, Kyotaro Horiguchi wrote: >> I found that commit ddfc2d9a37 removed the descriptions for >> pg_stat_get_blocks_fetched and pg_stat_get_blocks_hit. Right before >> that commit, monitoring.sgml had these lines: >> >> - pg_stat_get_blocks_fetched minus >> - pg_stat_get_blocks_hit gives the number of kernel >> - read() calls issued for the table, index, or >> - database; the number of actual physical reads is usually >> - lower due to kernel-level buffering. The *_blks_read >> - statistics columns use this subtraction, i.e., fetched minus hit. >> >> The commit then added the following sentence to the description for >> pg_statio_all_tables.heap_blks_read. >> >> Later, in 5f2b089387 it twas revised as: >> + Number of disk blocks read in this database > > Yeah, maybe adding something like that at the bottom of the table for > stat functions, telling that the difference is the number of read() > calls, may help. Perhaps also adding a mention that these are used in > none of the existing system views.. > >> The confusion stems from the inconsistency between the views and >> underlying functions related to block reads and hits. If we add >> descriptions for the two functions, we should also explain their >> relationship. I agree that adding more explanation would help and avoid confusion. What about something like? for pg_stat_get_xact_blocks_fetched(): "block read requests for table or index, in the current transaction. This number minus pg_stat_get_xact_blocks_hit() gives the number of kernel read() calls." pg_stat_get_xact_blocks_hit(): "block read requests for table or index, in the current transaction, found in cache (not triggering kernel read() calls)". Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com