Re: Track the amount of time waiting due to cost_delay
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, Masahiro Ikeda <ikedamsh@oss.nttdata.com>, "Imseih (AWS), Sami" <simseih@amazon.com>, Masahiko Sawada <sawada.mshk@gmail.com>, pgsql-hackers@lists.postgresql.org, Robert Haas <robertmhaas@gmail.com>
Date: 2024-12-11T07:00:50Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add delay time to VACUUM/ANALYZE (VERBOSE) and autovacuum logs.
- 7720082ae532 18.0 landed
-
Add cost-based vacuum delay time to progress views.
- bb8dff9995f2 18.0 landed
-
Add is_analyze parameter to vacuum_delay_point().
- e5b0b0ce1509 18.0 landed
-
Refresh cost-based delay params more frequently in autovacuum
- 7d71d3dd080b 16.0 cited
Hi, On Tue, Dec 10, 2024 at 11:55:41AM -0600, Nathan Bossart wrote: > On Mon, Dec 09, 2024 at 04:41:03PM +0000, Bertrand Drouvot wrote: > > + <structfield>time_delayed</structfield> <type>bigint</type> > > I think it's also worth considering names like total_delay and > cumulative_delay. That's fine by me. Then I think that total_delay is the way to go (I don't see any existing "cumulative_"). > > + Total amount of time spent in milliseconds waiting during <xref linkend="guc-vacuum-cost-delay"/> > > + or <xref linkend="guc-autovacuum-vacuum-cost-delay"/>. In case of parallel > > + vacuum the reported time is across all the workers and the leader. The > > + workers update the column no more frequently than once per second, so it > > + could show slightly old values. > > I wonder if it makes sense to provide this value as an interval instead of > the number of milliseconds to make it more human-readable. Yeah we could do so, but that would mean: 1. Write a dedicated "pg_stat_get_progress_info()" function for VACUUM. Indeed, the current pg_stat_get_progress_info() is shared across multiple "commands" and then we wouldn't be able to change it's output types in pg_proc.dat. Or 2. Make use of make_interval() in the pg_stat_progress_vacuum view creation. I don't like 1. that much and given that that would be as simple as: " select make_interval(secs => time_delayed / 1000) from pg_stat_progress_vacuum; " for an end user to display an interval, I'm not sure we should provide an interval by default. That said, I agree that milliseconds is not really human-readable and does not provide that much added value (except flexibility), so I'd vote for 2. if you feel we should provide an interval by default. > I might also > suggest some changes to the description: > > Total accumulated time spent sleeping due to the cost-based vacuum > delay settings (e.g., vacuum_cost_delay, vacuum_cost_limit). This > includes the time that any associated parallel workers have slept, too. > However, parallel workers report their sleep time no more frequently > than once per second, so the reported value may be slightly stale. > Yeah I like it, thanks! Now, I'm wondering if we should not also add something like this: " Since multiple workers can sleep simultaneously, the total sleep time can exceed the actual duration of the vacuum operation. " As that could be surprising to see this behavior in action. Thoughts? I'll provide an updated patch version once we agree on the above points. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com