From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Li EF Zhang <bjzhangl@cn.ibm.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: SQL to query running transactions with subtransactions that exceeds 64
Date: Thu, 07 Jan 2021 03:12:16 +0100
Message-ID: <74cc5b09ce921e4f57524ed76265847599dd42fc.camel@cybertec.at> (raw)
In-Reply-To: <OF562BD603.EFADC582-ON00258655.003D1268-00258655.003DBE6A@notes.na.collabserv.com>
References: <7e49c83b1179e052b415eb0f8f78f5f2c0dec734.camel@cybertec.at>
<OFDF3972D7.C7B31878-ON00258654.003A6B40-00258654.003ACE1D@notes.na.collabserv.com>
<OF562BD603.EFADC582-ON00258655.003D1268-00258655.003DBE6A@notes.na.collabserv.com>
On Wed, 2021-01-06 at 11:14 +0000, Li EF Zhang wrote:
> When I restart secondary node, it reported
> "DEBUG: recovery snapshot waiting for non-overflowed snapshot or until oldest active xid on standby is at least 4739126 (now 1422751)
> CONTEXT: WAL redo at 4/741941F8 for Standby/RUNNING_XACTS: nextXid 5137417 latestCompletedXid 5137409 oldestRunningXid 1422751; 17 xacts: 2716862 2721890 4665244 2495592 2289138 5137416 2288820
> 2287653 1422751 4280517 2288510 2287620 3297674 1757103 5137219 3320989 2259670; subxid ovf"
> I want to find the oldest running transaction(1422751) using the following SQL.
> But it showed that there was no transactions that running more than 5 minutes.
> How can I find the oldest running transaction?
>
> SELECT
> pid,
> now() - pg_stat_activity.query_start AS duration,
> query,
> state
> FROM pg_stat_activity
> WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes';
Use xact_start rather than query_start.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, bjzhangl@cn.ibm.com
Subject: Re: SQL to query running transactions with subtransactions that exceeds 64
In-Reply-To: <74cc5b09ce921e4f57524ed76265847599dd42fc.camel@cybertec.at>
References: <7e49c83b1179e052b415eb0f8f78f5f2c0dec734.camel@cybertec.at> <OFDF3972D7.C7B31878-ON00258654.003A6B40-00258654.003ACE1D@notes.na.collabserv.com> <OF562BD603.EFADC582-ON00258655.003D1268-00258655.003DBE6A@notes.na.collabserv.com> <74cc5b09ce921e4f57524ed76265847599dd42fc.camel@cybertec.at>
* 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