From: | Rui DeSousa <rui(at)crazybean(dot)net> |
---|---|
To: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
Cc: | Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: pg_stat_database.xact_commit + pg_stat_database.xact_rollback as a reliable metric for xid consumption ? |
Date: | 2020-06-01 15:58:48 |
Message-ID: | 3B1EF77A-B9DC-4F0A-AD1E-30876F65E2D5@crazybean.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
> On Jun 1, 2020, at 7:03 AM, Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
>
> On Mon, Jun 1, 2020 at 12:48 PM Achilleas Mantzios
> <achill(at)matrix(dot)gatewaynet(dot)com> wrote:
>>
>> On 1/6/20 1:36 μ.μ., Julien Rouhaud wrote:
>>> On Mon, Jun 1, 2020 at 12:02 PM Achilleas Mantzios
>>> <achill(at)matrix(dot)gatewaynet(dot)com> wrote:
>>> Because read only transaction usually don't consume an xid. So yes
>>> pg_stat_database gives a more reasonable approximation of the real
>>> number of transactions happening on the server.
>> Thank you, so what would be the official way to monitor txid consumption (from a MVCC / Freezing admin POV)?
>
> I'm not sure what you're really looking for. If it's the txid
> consumption rate, you can use txid_current() at regular interval to
> compute it (note that this function will consume a txid). For object
> freeeze, you can use age(datfrozenxid) from pg_database, or
> age(relfrozenxid) from pg_class.
>
>
I also record the stats tables every minute by either inserting into a table hist_ table or exporting the data out to be inserted into another table. When exporting the pg_stat_database table I added the following to record the information without the need to call txid_current():
coalesce(txid_current_if_assigned(), txid_snapshot_xmax(txid_current_snapshot())) as xact_txid, …
From | Date | Subject | |
---|---|---|---|
Next Message | Achilleas Mantzios | 2020-06-01 18:13:02 | Re: pg_stat_database.xact_commit + pg_stat_database.xact_rollback as a reliable metric for xid consumption ? |
Previous Message | Keith Fiske | 2020-06-01 15:47:32 | Re: Suggestion to Monitoring Tool |