Re: Re[2]: [PATCH] Add last_executed timestamp to pg_stat_statements

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Christoph Berg <myon(at)debian(dot)org>
Cc: Pavlo Golub <pavlo(dot)golub(at)cybertec(dot)at>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Re[2]: [PATCH] Add last_executed timestamp to pg_stat_statements
Date: 2026-02-04 02:37:31
Message-ID: CAA5RZ0tH_+3JGMCktkp8EMyvKaRAJf-xRh+y_UoZ8azvuUEAYQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > I wonder if we can use GetCurrentStatementStartTimestamp()
> > instead?
>
> The main use case for this column is being able to retrieve the stats
> that were updated since the last time one was looking. That only works
> if it's the statement end time, or else long-running statements
> spanning more than one poll interval would be missed.

Sure, I get it is not perfect for the polling use-case due to the scenario
you mention, but I don't think it will be acceptable to call
GetCurrentTimeStamp() at the end of every execution and especially
with a SpinLock held.

This will probably be worse for nested_tacking as well, due to
multiple GetCurrentTimeStamp() calls.

What do you think?

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zane Duffield 2026-02-04 02:42:49 Proposal: pg_createsubscriber use without superuser privileges
Previous Message wangpeng 2026-02-04 01:56:45 Re: pg_dumpall --roles-only interact with other options