Re: Check what has been done for a uncommitted prepared transaction

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Check what has been done for a uncommitted prepared transaction
Date: 2020-05-14 13:33:25
Message-ID: 1e39c06492fe7ee13946d648b5f4749d116b077e.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2020-05-14 at 16:26 +0800, Andy Fan wrote:
> Thanks, actually I don't know how to use prepared transaction and how it works.
> I care about this because there is a long prepared transaction exists in our customer,
> and we want to know what this transaction has done(like any data it changed).
> All the things I know is the data comes from pg_prepared_xact, but it doesn't help a lot.

Idf you have the transaction ID from "pg_prepared_xact", you could check
what locks are held:

SELECT * FROM pg_locks WHERE transactionid = ...;

Than might give you a clue.

Using prepared transactions without a transaction manager that keeps track of them
and cleans up if necessary is dangerous.

Yours,
Laurenz Albe
--
+43-670-6056265
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-05-14 13:33:40 Re: Reuse an existing slot with a new initdb
Previous Message Tom Lane 2020-05-14 13:26:44 Re: PG12.2 Configure cannot enalble SSL