Thread: Re: POC: track vacuum/analyze cumulative time per relation

Re: POC: track vacuum/analyze cumulative time per relation

From
Bertrand Drouvot
Date:
Hi,

On Mon, Jan 27, 2025 at 09:30:16AM +0900, Michael Paquier wrote:
> The addition of the extra GetCurrentTimestamp() in the report path
> does not stress me much, 

Reading at the previous messages I see how you reached this state. I also think
that makes sense and that's not an issue as we are not in a hot path here.

> should just do the attached, which is simpler and addresses your
> use-case.  Note also that the end time is acquired while the entries
> are not locked in the report routines, and some tweaks in the docs and
> comments.

LGTM.

Regards,

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



Re: POC: track vacuum/analyze cumulative time per relation

From
Sami Imseih
Date:
> I think that this is hiding a behavior change while adding new
> counters, and both changes are independent.

That's a fair point.

> Another thing that is
> slightly incorrect to do if we take the argument of only adding the
> counters is moving around the call of pgstat_progress_end_command(),
> because it's not really wrong as-is, either.  I'd suggest to make all
> that a separate discussion.

Yeah, we have inconsistency between when vacuum and analyze
command ends as well as inconsistency  between the time
reported to pg_stats vs the logs. I will start a follow-up thread for
this.

> I have put my hands on this patch, and at the end I think that we
> should just do the attached, which is simpler and addresses your
> use-case.  Note also that the end time is acquired while the entries
> are not locked in the report routines, and some tweaks in the docs and
> comments.

Thanks for the update. This LGTM.

Regards,

Sami



Re: POC: track vacuum/analyze cumulative time per relation

From
Alena Rybakina
Date:

Hi!

On 28.01.2025 03:59, Michael Paquier wrote:
On Mon, Jan 27, 2025 at 11:22:16AM -0600, Sami Imseih wrote:
I have put my hands on this patch, and at the end I think that we
should just do the attached, which is simpler and addresses your
use-case.  Note also that the end time is acquired while the entries
are not locked in the report routines, and some tweaks in the docs and
comments.
Thanks for the update. This LGTM.
Okidoki.  Done, then, with bumps for the catalog version and the stats
file version.

You might be interested in looking at my patch for collecting vacuum statistics? Same issue, but it collects more information about the vacuum procedure for relations and databases.

I mentioned it here [0] in the current thread.

[0] https://www.postgresql.org/message-id/Z4U3hkWuEgByhGgJ%40ip-10-97-1-34.eu-west-3.compute.internal

-- 
Regards,
Alena Rybakina
Postgres Professional