How to get active table within a transaction.

Started by Hubert Zhangover 7 years ago2 messages
#1Hubert Zhang
hzhang@pivotal.io

Hi all,

I have a requirement to get the active table list in a child postmaster
process.

We are able to get the active table list after corresponding transaction
ends by using stat collector. Each postgres process will gather the table
change information locally, but only send the stat info to collector after
transaction end(become idle).

As an enhancement, we also want to get the active table while the
transaction inserting the table is in progress. Delay is acceptable.

Is there any existing ways in PG to support it?

--
Thanks

Hubert Zhang

#2Nasby, Jim
nasbyj@amazon.com
In reply to: Hubert Zhang (#1)
Re: How to get active table within a transaction.

On Sep 19, 2018, at 11:08 PM, Hubert Zhang <hzhang@pivotal.io> wrote:

Hi all,

I have a requirement to get the active table list in a child postmaster process.

We are able to get the active table list after corresponding transaction ends by using stat collector. Each postgres process will gather the table change information locally, but only send the stat info to collector after transaction end(become idle).

As an enhancement, we also want to get the active table while the transaction inserting the table is in progress. Delay is acceptable.

Is there any existing ways in PG to support it?

You might be able to use pg_stat_xact_all_tables for that.