From: | Shayon Mukherjee <shayonj(at)gmail(dot)com> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | Robert Treat <rob(at)xzilla(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Prolonged truncation phase during vacuum on toast table with repeated interruptions by lock waiters and a proposed POC patch |
Date: | 2025-08-09 14:48:56 |
Message-ID: | CANqtF-qM9+tUVCe=OAOC7Zs0mYzv1zVbNdEzoG47JSdeaFwx2A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, May 8, 2025 at 4:58 PM Shayon Mukherjee <shayonj(at)gmail(dot)com> wrote:
> +1 for this. I'd even be happy to even just start showing the attempts as
> part of INFO or VERBOSE on conflicts & suspensions, without keeping track,
> but it is useful statistical data.
>
>
Hi hackers,
Following up on the recent discussion about prolonged VACUUM truncation
phases on busy systems, I took a stab at extending the logging to add a
little bit more visibility into the truncation process.
With this patch, when VACUUM is run with VERBOSE, it will now log the
following:
1. Individual suspension messages with attempt count and cumulative elapsed
time.
2. A summary at the end of the truncation process showing the total number
of suspensions and the total elapsed time.
Example output:
INFO: table "toast_target_table": suspending truncate due to conflicting
lock request (attempt 1, elapsed: 0.121 s)
INFO: table "toast_target_table": truncated 372096 to 370624 pages
INFO: table "toast_target_table": suspending truncate due to conflicting
lock request (attempt 2, elapsed: 6.108 s)
...
INFO: table "toast_target_table": truncation completed after 8
suspension(s), total elapsed: 58.090 s
Perhaps, this can give developers the information needed to identify
problematic truncation behavior and decide whether to use VACUUM (TRUNCATE
OFF) for specific tables.
Additionally, tracking these stats in a table would be useful as well.
Curious, if something like this is desirable by the community?
Proposal patch is attached. Some notes on the patch:
- Unclear if there is a best way to write regression tests for this, since
it can be flaky.
- There seems to be translation support for the copy. At least for the
initial patch, I have left that and happy to discuss more if the patch
feels viable.
Thank you
Shayon
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Extend-logging-for-VACUUM-truncation-suspensions-.patch | application/octet-stream | 5.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey Borodin | 2025-08-09 15:28:41 | Re: VM corruption on standby |
Previous Message | Alvaro Herrera | 2025-08-09 13:33:31 | Re: Adding REPACK [concurrently] |