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 1jUpne-00061U-Vp for pgsql-hackers@arkaria.postgresql.org; Sat, 02 May 2020 10:55:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jUpnc-0006xR-Jw for pgsql-hackers@arkaria.postgresql.org; Sat, 02 May 2020 10:55:12 +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 1jUpnc-0006xK-8c for pgsql-hackers@lists.postgresql.org; Sat, 02 May 2020 10:55:12 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jUpnU-0007gK-HK for pgsql-hackers@postgresql.org; Sat, 02 May 2020 10:55:11 +0000 Received: by mail-wm1-x344.google.com with SMTP id x4so2781682wmj.1 for ; Sat, 02 May 2020 03:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=842wd2Ss5UabOg8pmc8QiIMI4DpzwLDsG13wki3qxcE=; b=egASeTYOGqnhFLoWRn/0D5IPYY1DzBnE7+/adOliZMpwq44e8nnxlOVpdjlt6rFvVU FosBZYLoVOkul8QBFQE+NqSsKqBDw27OnuuSgpnRFUp+9cEL4CTsct2qicgL8vaz3Ihl OJ3B7RJfsIm888t9zutvzmiCcNaiYyc+kRPD45kfIkOLRMl0Bl78E+P+Nu+AHkV/m6vo 80T58RKJeYEiTRJLWv0I1FH6F8Yf0HA5r3duWysDFfkWus2AGNg8IofanUieybmIIxQO kbrgpsJMZMrjguXqax1XhduXbD3uivTdFZ+tC6trso04nnh8Jm/mq1X3WNE9A3vlUdJ1 eyVw== 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:content-transfer-encoding :in-reply-to; bh=842wd2Ss5UabOg8pmc8QiIMI4DpzwLDsG13wki3qxcE=; b=C8W1uXUK3vsdNtMvAt6vaHtzYLJ71xJSqCBBPO9SYDDaEmx93GqBimr1SxGz39/zyZ lDiau3HQ+s4DgH6ZIFa0SMkfNyKtUtAmieh5OcT4oxL00g1h20h/iG0ylNQWWKpyI8lt hK8DqlHDJxL8iOqHefivjQt8+Wxt5bnGRVu4vnozSxXoxVr0/SH0tb/WZZt0ShNOsums O5MPBSjSO/HnyUtO+cNNNGBpeqY+/SvpUyDBpZqSDXikbzkdPfwEH4C/U+1ZXzEslHcz VX9CKCZfZx1A7HLo2xmSaU8JOOeQxRma34xweSAgDgIbxjvY1sTZZo98T5aHivGu0qj9 +IZw== X-Gm-Message-State: AGi0PuZuK9T9TBgFWf9dFGuggZATHvu93Alrq+IwYGi8hXP7DXpKO6i+ XwPfoAzSwiW9EvBGi0O/PVph4g== X-Google-Smtp-Source: APiQypJAkFhzU0Ipaq8xldjz28CZSCmJrj4wZCKI1ht13YSAqv3KHX9v1knicbXUKtWYnFwQZo29FQ== X-Received: by 2002:a05:600c:2157:: with SMTP id v23mr3869436wml.149.1588416903214; Sat, 02 May 2020 03:55:03 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id c190sm3799916wme.10.2020.05.02.03.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 May 2020 03:55:02 -0700 (PDT) Date: Sat, 2 May 2020 12:55:00 +0200 From: Tomas Vondra To: Fujii Masao Cc: Alvaro Herrera , Masahiko Sawada , "tsunakawa.takay@fujitsu.com" , "pgsql-hackers@postgresql.org" Subject: Re: SLRU statistics Message-ID: <20200502105500.hwhba3d6s3hlrqf6@development> References: <20200229144426.GA32500@alvherre.pgsql> <20200229205518.xrxo535zgd7cl6no@development> <20200327004111.md4suoi6u5suv2qe@development> <20200328002630.2nz5y3dvymqnvxtv@development> <20200402004136.wodwftan45mcwggm@development> <20200430181901.24tlriahmafi4sfn@development> <0e1c8904-13be-ab70-0096-54f0b30e43ba@oss.nttdata.com> <20200502000818.nn4kpewiput42bnb@development> <49b8ad17-f6d9-a086-a952-ff1fec3ac1b3@oss.nttdata.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <49b8ad17-f6d9-a086-a952-ff1fec3ac1b3@oss.nttdata.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, May 02, 2020 at 03:56:07PM +0900, Fujii Masao wrote: > > >On 2020/05/02 9:08, Tomas Vondra wrote: >>On Fri, May 01, 2020 at 11:49:51AM +0900, Fujii Masao wrote: >>> >>> >>>On 2020/05/01 3:19, Tomas Vondra wrote: >>>>On Fri, May 01, 2020 at 03:02:59AM +0900, Fujii Masao wrote: >>>>> >>>>> >>>>>On 2020/04/02 9:41, Tomas Vondra wrote: >>>>>>Hi, >>>>>> >>>>>>I've pushed this after some minor cleanup and improvements. >>>>> >>>>>+static char *slru_names[] = {"async", "clog", "commit_timestamp", >>>>>+                              "multixact_offset", "multixact_member", >>>>>+                              "oldserxid", "pg_xact", "subtrans", >>>>>+                              "other" /* has to be last */}; >>>>> >>>>>When I tried pg_stat_slru, I found that it returns a row for "pg_xact". >>>>>But since there is no "pg_xact" slru ("clog" slru exists instead), >>>>>"pg_xact" should be removed? Patch attached. >>>>> >>>> >>>>Yeah, I think I got confused and accidentally added both "clog" and >>>>"pg_xact". I'll get "pg_xact" removed. >>> >>>Thanks! >>> >> >>OK, pushed. Thanks! > >Thanks a lot! > >But, like the patch that I attached in the previous email does, >"pg_xact" should be removed from the description of pg_stat_reset_slru() >in monitoring.sgml. > Whooops. My bad, will fix. >>>Another thing I found is; pgstat_send_slru() should be called also by >>>other processes than backend? For example, since clog data is flushed >>>basically by checkpointer, checkpointer seems to need to send slru stats. >>>Otherwise, pg_stat_slru.flushes would not be updated. >>> >> >>Hmmm, that's a good point. If I understand the issue correctly, the >>checkpointer accumulates the stats but never really sends them because >>it never calls pgstat_report_stat/pgstat_send_slru. That's only called >>from PostgresMain, but not from CheckpointerMain. > >Yes. > >>I think we could simply add pgstat_send_slru() right after the existing >>call in CheckpointerMain, right? > >Checkpointer sends off activity statistics to the stats collector in >two places, by calling pgstat_send_bgwriter(). What about calling >pgstat_send_slru() just after pgstat_send_bgwriter()? > Yep, that's what I proposed. >In previous email, I mentioned checkpointer just as an example. >So probably we need to investigate what process should send slru stats, >other than checkpointer. I guess that at least autovacuum worker, >logical replication walsender and parallel query worker (maybe this has >been already covered by parallel query some mechanisms. Sorry I've >not checked that) would need to send its slru stats. > Probably. Do you have any other process type in mind? >Atsushi-san reported another issue in pg_stat_slru. >You're planning to work on that? >https://postgr.es/m/CACZ0uYFe16pjZxQYaTn53mspyM7dgMPYL3DJLjjPw69GMCC2Ow@mail.gmail.com > Yes, I'll investigate. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services