Re: Use pgBufferUsage for block reporting in analyze
Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-05-28T09:00:51Z
Lists: pgsql-hackers
Attachments
- v2-0001-Use-pgBufferUsage-for-block-reporting-in-analyze.patch (application/octet-stream) patch v2-0001
- v2-0002-Output-buffer-and-wal-usage-with-verbose-analyze.patch (application/octet-stream) patch v2-0002
Thanks for having a look. On Fri, May 10, 2024 at 12:40 PM Michael Paquier <michael@paquier.xyz> wrote: > This needs some runtime check to make sure that the calculations > are consistent before and after the fact (cannot do that now). > Yeah, testing this is also a bit painful as buffer usage of analyze is only displayed in the logs during autoanalyze. While looking at this, I've thought of additional changes that could make testing easier and improve consistency with VACUUM VERBOSE: - Have ANALYZE VERBOSE outputs the buffer usage stats - Add Wal usage to ANALYZE VERBOSE analyze verbose output would look like: postgres=# analyze (verbose) pgbench_accounts ; INFO: analyzing "public.pgbench_accounts" INFO: "pgbench_accounts": scanned 1640 of 1640 pages, containing 100000 live rows and 0 dead rows; 30000 rows in sample, 100000 estimated total rows INFO: analyze of table "postgres.public.pgbench_accounts" avg read rate: 124.120 MB/s, avg write rate: 0.110 MB/s buffer usage: 533 hits, 1128 reads, 1 dirtied WAL usage: 12 records, 1 full page images, 5729 bytes system usage: CPU: user: 0.06 s, system: 0.00 s, elapsed: 0.07 s 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. > Sounds good. That's not material for v17, only for v18. > Definitely I've split the patch in two parts 1: Removal of the vacuum specific variables, this is the same as the initial patch. 2: Add buffer and wal usage to analyze verbose output + rename miss to reads Regards, Anthonin
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