Re: Flush some statistics within running transactions - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: Flush some statistics within running transactions
Date
Msg-id CAA5RZ0uYeH=XN97Vdd_n2dv-ZMK529nrPE3vvaY53Eb_qOfWhg@mail.gmail.com
Whole thread Raw
In response to Re: Flush some statistics within running transactions  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: Flush some statistics within running transactions
List pgsql-hackers
Thanks for the updated patches!

> No, 0003 also changes the flush mode for the database KIND. All the fields that
> I mentioned are inherited from relations stats and are flushed only at transaction
> boundaries (so they don't appear in pg_stat_database until the transaction
> finishes). Does that make sense?

yes, I understand it clearly now.

But, the Note under pg_stat_database reads like this:

"All the statistics are updated while the transactions are in progress,
except for xact_commit, xact_rollback, tup_inserted, tup_updated
and tup_deleted that are updated only when the transactions finish."

But that is not true for all pg_stat_database fields, such as session_time,
active_time, idle_in_transaction_time, etc. From what I can tell some of their
fields are updated when the connection is closed. For example
in one session run "select pg_sleep(10)" and in another session monitor
pg_stat_database.active_time. That will not be updated until the session
is closed.

This is because these are not relation stats, which makes sense. The
Note section should elaborate more on this, right?

--
Sami Imseih
Amazon Web Services (AWS)



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: POC: Parallel processing of indexes in autovacuum
Next
From: Masahiko Sawada
Date:
Subject: Re: pg_upgrade: optimize replication slot caught-up check