Patch: show xid and xmin in pg_stat_activity and pg_stat_replication

From: Christian Kruse <christian(at)2ndQuadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Patch: show xid and xmin in pg_stat_activity and pg_stat_replication
Date: 2013-12-17 14:58:19
Message-ID: 20131217145819.GC17364@achilles.fritz.box
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

attached you will find a patch for showing the current transaction id
(xid) and the xmin of a backend in pg_stat_activty and the xmin in
pg_stat_replication.

This may be helpful when looking for the cause of bloat.

I added two new struct members in PgBackendStatus which get filled in
pgstat_read_current_status() and slightly modified the catalog schema
and the pg_stat_get_activity() procedure.

I'm not sure if it is a good idea to gather the data in
pgstat_read_current_status(), but I chose to do it this way
nonetheless because otherwise I would have to create collector
functions like pgstat_report_xid_assignment() /
pgstat_report_xmin_changed() (accordingly to
pgstat_report_xact_timestamp()) which may result in a performance hit.

Regards,

--
Christian Kruse http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
xid_and_xmin_in_pg_stat_activity_and_pg_stat_replication.patch text/x-diff 6.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message bricklen 2013-12-17 14:59:03 Re: "stuck spinlock"
Previous Message Robert Haas 2013-12-17 14:56:33 Re: Proposal: variant of regclass