Re: Use pgBufferUsage for block reporting in analyze
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-05-10T10:40:35Z
Lists: 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
Commits
-
Add WAL usage reporting to ANALYZE VERBOSE output.
- bb7775234273 18.0 landed
-
Add resource statistics reporting to ANALYZE VERBOSE.
- 4c1b4cdb86a7 18.0 landed
-
Use pgBufferUsage for buffer usage tracking in analyze.
- c584781bcc68 18.0 landed
-
Fix parallel vacuum buffer usage reporting.
- 5cd72cc0c501 17.0 cited