Re: Transaction Id and status of any operation

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Transaction Id and status of any operation
Date: 2013-11-19 22:35:14
Message-ID: 1384900514.61511.YahooMailNeo@web162902.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:

> I want to know the file or function from code which can give me
> the transaction Id and its status. For example I want to find the
> details of transaction currently inserting on some specific
> table.

From the connection inserting the rows, these functions might help:

http://www.postgresql.org/docs/current/interactive/functions-info.html#FUNCTIONS-TXID-SNAPSHOT

If you want some other connection to figure this out, you might
want to inspect the pg_stat_activity and/or pg_locks views.

http://www.postgresql.org/docs/current/interactive/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW

http://www.postgresql.org/docs/current/interactive/view-pg-locks.html

> Also please tel me what function are called to check whether
> status of transaction has changed. For example, I would like to
> get notified whenever the status of any transaction changes.
> Please tel me the files or function for this.

Are you talking about the state and/or waiting columns in
pg_stat_activity, looking to determine when a transaction
completes, or something else?

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Merlin Moncure 2013-11-19 23:51:39 Re: Transaction Id and status of any operation
Previous Message Luca Ferrari 2013-11-19 10:29:37 Re: Request for information || Begining flow of postgresql