pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: pg_stat_database.xact_commit + pg_stat_database.xact_rollback as a reliable metric for xid consumption ?
Date: Mon, 1 Jun 2020 21:13:02 +0300
Message-ID: <3d0096c7-f79f-5100-fe16-55677ce67006@matrix.gatewaynet.com> (raw)
In-Reply-To: <CAODZiv4jb12wTPTnQqv5E291ZSGSAw7VkmKH1Ajeqw3jTON7Pw@mail.gmail.com>
References: <51fa222b-374e-39da-eb8c-66d667426bae@matrix.gatewaynet.com>
	<CAOBaU_Zc5o=pKopyh=U02xw_FPN_ZWBhqe=-hSTPC-n7JF=X2g@mail.gmail.com>
	<36dd7ae2-7c6f-86af-430b-dd9a0f7774b3@matrix.gatewaynet.com>
	<CAOBaU_b3BG2jicgv7Woyo8vT1V3dnw4xPvMR=AuZ6hMWYuPjKQ@mail.gmail.com>
	<eaded5fd-379e-1bd8-ebc6-dc85d72db4d1@matrix.gatewaynet.com>
	<CAODZiv4jb12wTPTnQqv5E291ZSGSAw7VkmKH1Ajeqw3jTON7Pw@mail.gmail.com>


On 1/6/20 5:52 μ.μ., Keith Fiske wrote:
>
>
> On Mon, Jun 1, 2020 at 8:41 AM Achilleas Mantzios 
> <achill@matrix.gatewaynet.com <mailto:achill@matrix.gatewaynet.com>> 
> wrote:
>
>     Hello Julien
>     On 1/6/20 2:03 μ.μ., Julien Rouhaud wrote:
>     > On Mon, Jun 1, 2020 at 12:48 PM Achilleas Mantzios
>     > <achill@matrix.gatewaynet.com
>     <mailto:achill@matrix.gatewaynet.com>> wrote:
>     >> On 1/6/20 1:36 μ.μ., Julien Rouhaud wrote:
>     >>> On Mon, Jun 1, 2020 at 12:02 PM Achilleas Mantzios
>     >>> <achill@matrix.gatewaynet.com
>     <mailto:achill@matrix.gatewaynet.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.
>     I've been as explicit as it gets. When ppl talk about vacuum
>     freeze what they have in mind is xmin's and xmax's and the rate
>     that xids grow and consume the 2^31 address space, so I find it
>     strange
>     that such a basic metric is not included in the core statistics
>     collector.
>     That's all.
>     >
>
>
>     -- 
>     Achilleas Mantzios
>     IT DEV Lead
>     IT DEPT
>     Dynacom Tankers Mgmt
>
>
>
>
> I've done a writeup on effectively monitoring for xid 
> exhaustion/wraparound.
>
> https://info.crunchydata.com/blog/managing-transaction-id-wraparound-in-postgresql
>
Thank you, seems like a nice write-up, I'll check this out.
> It is relatively simple to get the current xid state applying the 
> age() function to the pg_database catalog:
>
> SELECT datname, age(datfrozenxid), 
> current_setting('autovacuum_freeze_max_age') FROM pg_database ORDER BY 
> 2 DESC;
>
> But the query in the linked blog post provides things in a more 
> user-friendly manner for monitoring purposes as simple percentages
>
> -- 
> Keith Fiske
> Senior Database Engineer
> Crunchy Data - http://crunchydata.com

view thread (10+ messages)  latest in thread

Message-ID: <3d0096c7-f79f-5100-fe16-55677ce67006@matrix.gatewaynet.com>
Permalink:  ../3d0096c7-f79f-5100-fe16-55677ce67006@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/3d0096c7-f79f-5100-fe16-55677ce67006@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: achill@matrix.gatewaynet.com, pgsql-admin@lists.postgresql.org
  Subject: Re: pg_stat_database.xact_commit + pg_stat_database.xact_rollback as a reliable metric for xid consumption ?
  In-Reply-To: <3d0096c7-f79f-5100-fe16-55677ce67006@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox