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