Re: Transaction ID not logged if no explicit transaction used - Mailing list pgsql-general

From Martín Marqués
Subject Re: Transaction ID not logged if no explicit transaction used
Date
Msg-id 56BD0E4E.5050503@2ndquadrant.com
Whole thread Raw
In response to Re: Transaction ID not logged if no explicit transaction used  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Transaction ID not logged if no explicit transaction used  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-general
El 10/02/16 a las 21:46, Tom Lane escribió:
>
> Think you're outta luck on that.  If we logged the duration before
> commit, it would be entirely misleading for short commands, because
> the time needed to commit wouldn't be included.  So we log it after,
> when there's no longer any active transaction.

Any other way to log the DDL and DML statements (maybe delay writing the
log until the xid is available)?

Yes, I know the complexity of this, but I'm surprised this hasn't come
up in the list before (maybe it did and i missed the mail).

> We could maybe fix this by redefining %x as "the current or most recent
> xid", so that it'd still be valid for messages issued post-commit.
> But I'm afraid that would add about as many bad behaviors as it would
> remove.  In your example above, that would result in a pretty misleading
> xid attached to the "begin" statement, since at that point we have
> started a new transaction but not assigned it any xid.

This really gives little use for recovery_target_xid. :(

Regards,

--
Martín Marqués                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


pgsql-general by date:

Previous
From: Yury Zhuravlev
Date:
Subject: Re: Test CMake build
Next
From: Alvaro Herrera
Date:
Subject: Re: Transaction ID not logged if no explicit transaction used