Tom Lane wrote: > Amit Kapila <amit.kapil...@gmail.com> writes: > > I am wondering that is there any harm in calling TransactionIdDidAbort() > > in slow path before calling SubTransGetTopmostTransaction(), that can > > also maintain consistency of checks in both the functions? > > I think this is probably a bad idea. It adds a pg_clog lookup that we > would otherwise not do at all, in hopes of avoiding a pg_subtrans lookup. > It's not exactly clear that that's a win even if we successfully avoid > the subtrans lookup (which we often would not). And even if it does win, > that would only happen if the other transaction has aborted, which isn't > generally the case we prefer to optimize for.
It's probably key to this idea that TransactionIdDidAbort returns in a single slru lookup, whereas SubTransGetTopmostTransaction needs to iterate possibly many layers of subxacts. But the point about this being a win only for aborted xacts makes it probably pointless, I agree. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers