Re: Track the amount of time waiting due to cost_delay

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>, "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Track the amount of time waiting due to cost_delay
Date: 2024-12-13 05:04:13
Message-ID: Z1vATSIzkPoLkHEN@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v12-0001-Report-the-total-amount-of-time-that-vacuum-has-.patch text/x-diff 9.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2024-12-13 05:22:38 Re: Statistics Import and Export
Previous Message Hunaid Sohail 2024-12-13 04:47:51 Re: Psql meta-command conninfo+