Re: Use pgBufferUsage for block reporting in analyze

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use pgBufferUsage for block reporting in analyze
Date: 2024-05-28 09:00:51
Message-ID: CAO6_XqqBhMYSNQYR54oMJf5m_vm=yP-SQwO_0Rx0aGsh7=U0Jg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for having a look.

On Fri, May 10, 2024 at 12:40 PM Michael Paquier <michael(at)paquier(dot)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 Content-Type Size
v2-0001-Use-pgBufferUsage-for-block-reporting-in-analyze.patch application/octet-stream 7.5 KB
v2-0002-Output-buffer-and-wal-usage-with-verbose-analyze.patch application/octet-stream 6.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2024-05-28 09:17:16 Re: Conflict Detection and Resolution
Previous Message Markus Winand 2024-05-28 08:19:50 ON ERROR in json_query and the like