| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Sami Imseih <samimseih(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Subject: | Re: Flush some statistics within running transactions |
| Date: | 2026-01-26 07:35:20 |
| Message-ID: | aXcZODT8H3AfdccG@ip-10-97-1-34.eu-west-3.compute.internal |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Thu, Jan 22, 2026 at 11:23:29AM -0600, Sami Imseih wrote:
> > For example, pgstat_update_dbstats() updates some of them: xact_commit, xact_rollback,
> > blk_read_time, blk_write_time, session_time, active_time and idle_in_transaction_time
> > but only at transaction boundaries. Indeed, pgstat_update_dbstats() is only called
> > during pgstat_report_stat() and not during pgstat_report_anytime_stat().
> >
> > I think that we could:
> >
> > 1. Update the doc as you suggest
>
> I am thinking the _time related fields are OK to be non-anytime
> fields, since they
> have overhead and also they can be actively monitored from pg_stat_activity
> if someone really needs real time information.
>
> The other session related counters don't need need special consideration.
>
> parallel counters are anytime.
>
> So, the documentation can mention the _time related fields that are flushed
> only at their appropriate times.
>
> Maybe something general like this:
>
> "Some statistics are updated while a transaction is in progress.
> Statistics that either do
> not depend on transactions or require transactional consistency are
> updated only
> when the transaction ends. Statistics that require transactional consistency
> include xact_commit, xact_rollback, tup_inserted, tup_updated, and tup_deleted."
>
> What do you think?
Thanks!
That sounds good, maybe just change the first sentence to something like:
"
Some statistics are updated while a transaction is in progress (this includes
blks_read, blks_hit, tup_returned and tup_fetched).
"
Thoughts?
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-01-26 07:42:38 | Re: Extended Statistics set/restore/clear functions. |
| Previous Message | Antonin Houska | 2026-01-26 07:34:40 | Re: Adding REPACK [concurrently] |