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

From Anthonin Bonnefoy
Subject Re: Use pgBufferUsage for block reporting in analyze
Date
Msg-id CAO6_XqqBhMYSNQYR54oMJf5m_vm=yP-SQwO_0Rx0aGsh7=U0Jg@mail.gmail.com
Whole thread Raw
In response to Re: Use pgBufferUsage for block reporting in analyze  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
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
Attachment

pgsql-hackers by date:

Previous
From: Markus Winand
Date:
Subject: ON ERROR in json_query and the like
Next
From: Nisha Moond
Date:
Subject: Re: Conflict Detection and Resolution