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-13T05:04:13Z
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 →
  1. Add delay time to VACUUM/ANALYZE (VERBOSE) and autovacuum logs.

  2. Add cost-based vacuum delay time to progress views.

  3. Add is_analyze parameter to vacuum_delay_point().

  4. Refresh cost-based delay params more frequently in autovacuum

Attachments

Hi,

On Thu, Dec 12, 2024 at 10:15:18AM -0600, Nathan Bossart wrote:
> On Thu, Dec 12, 2024 at 04:36:21AM +0000, Bertrand Drouvot wrote:
> > --- a/src/backend/catalog/system_views.sql
> > +++ b/src/backend/catalog/system_views.sql
> > @@ -1222,7 +1222,8 @@ CREATE VIEW pg_stat_progress_vacuum AS
> >          S.param4 AS heap_blks_vacuumed, S.param5 AS index_vacuum_count,
> >          S.param6 AS max_dead_tuple_bytes, S.param7 AS dead_tuple_bytes,
> >          S.param8 AS num_dead_item_ids, S.param9 AS indexes_total,
> > -        S.param10 AS indexes_processed
> > +        S.param10 AS indexes_processed,
> > +        make_interval(secs => S.param11 / 1000) AS total_delay
> >      FROM pg_stat_get_progress_info('VACUUM') AS S
> >          LEFT JOIN pg_database D ON S.datid = D.oid;
> 
> I think we need to cast one of the operands to "double precision" to avoid
> chopping off the fractional part of the result of the division, which seems
> important for this case since we are dealing with lots of small sleeps.

Makes sense, done in the attached.

> Otherwise, at a glance, I think this one is just about ready for commit.

Thanks for looking at it!

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com