Re: Use pgBufferUsage for block reporting in analyze
Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Karina Litskevich <litskevichkarina@gmail.com>,
Michael Paquier <michael@paquier.xyz>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-07-29T07:11:52Z
Lists: pgsql-hackers
Attachments
- v4-0002-Output-buffer-and-wal-usage-with-verbose-analyze.patch (application/octet-stream) patch v4-0002
- v4-0001-Use-pgBufferUsage-for-block-reporting-in-analyze.patch (application/octet-stream) patch v4-0001
- v4-0003-Pass-StringInfo-logbuf-to-AcquireSampleFunc.patch (application/octet-stream) patch v4-0003
On Sat, Jul 27, 2024 at 12:35 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > An alternative idea would > be to pass StringInfo to AcquireSampleRowsFunc() so that callback can > write its messages there. This is somewhat similar to what we do in > the EXPLAIN command (cf, ExplainPropertyText() etc). It could be too > much but I think it could be better than writing logs in the single > format. I've tested this approach, it definitely looks better. I've added a logbuf StringInfo to AcquireSampleRowsFunc which will receive the logs. elevel was removed as it is not used anymore. Since everything is in the same log line, I've removed the relation name in the acquire sample functions. For partitioned tables, I've also added the processed partition table being sampled. The output will look like: INFO: analyze of table "postgres.public.test_partition" Sampling rows from child "public.test_partition_1" pages: 5 of 5 scanned tuples: 999 live tuples, 0 are dead; 999 tuples in sample, 999 estimated total tuples Sampling rows from child "public.test_partition_2" pages: 5 of 5 scanned tuples: 1000 live tuples, 0 are dead; 1000 tuples in sample, 1000 estimated total tuples avg read rate: 2.604 MB/s, avg write rate: 0.000 MB/s ... For a file_fdw, the output will be: INFO: analyze of table "postgres.public.pglog" tuples: 60043 tuples; 30000 tuples in sample avg read rate: 0.000 MB/s, avg write rate: 0.000 MB/s ... 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