Re: Use pgBufferUsage for block reporting in analyze - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Use pgBufferUsage for block reporting in analyze
Date
Msg-id Zj35o7y1bTFSvsqE@paquier.xyz
Whole thread Raw
In response to Use pgBufferUsage for block reporting in analyze  (Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>)
Responses Re: Use pgBufferUsage for block reporting in analyze
List pgsql-hackers
On Fri, May 10, 2024 at 10:54:07AM +0200, Anthonin Bonnefoy wrote:
> This patch replaces those Vacuum specific variables by pgBufferUsage
> in analyze. This makes VacuumPage{Hit,Miss,Dirty} unused and removable.
> This commit removes both their calls in bufmgr and their declarations.

Hmm, yeah, it looks like you're right.  I can track all the blocks
read, hit and dirtied for VACUUM and ANALYZE in all the code path
where these removed variables were incremented.  This needs some
runtime check to make sure that the calculations are consistent before
and after the fact (cannot do that now).

             appendStringInfo(&buf, _("buffer usage: %lld hits, %lld misses, %lld dirtied\n"),
-                             (long long) AnalyzePageHit,
-                             (long long) AnalyzePageMiss,
-                             (long long) AnalyzePageDirty);
+                             (long long) (bufferusage.shared_blks_hit + bufferusage.local_blks_hit),
+                             (long long) (bufferusage.shared_blks_read + bufferusage.local_blks_read),
+                             (long long) (bufferusage.shared_blks_dirtied + bufferusage.local_blks_dirtied));

Perhaps this should say "read" rather than "miss" in the logs as the
two read variables for the shared and local blocks are used?  For
consistency, at least.

That's not material for v17, only for v18.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Nazir Bilal Yavuz
Date:
Subject: Re: Fix parallel vacuum buffer usage reporting
Next
From: Alvaro Herrera
Date:
Subject: Re: open items