Re: Compressing the AFTER TRIGGER queue - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Compressing the AFTER TRIGGER queue
Date
Msg-id 29407.1312225017@sss.pgh.pa.us
Whole thread Raw
In response to Re: Compressing the AFTER TRIGGER queue  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Compressing the AFTER TRIGGER queue
Re: Compressing the AFTER TRIGGER queue
List pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On 1 August 2011 18:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Aug 1, 2011 at 1:42 PM, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>>> Don't we already do that when pruning HOT chains?

>> I thought that only happens after the transaction is committed, and
>> old enough, whereas the trigger code only needs to follow the chain in
>> the updating transaction.

> Hmm, true.

On reflection I think we're probably worrying over nothing.  The only
way that the t_ctid link might have gotten changed (given that the
original updating subtransaction hasn't been aborted) is if we were
willing to prune an inserted-and-then-deleted-in-same-xact tuple out of
the t_ctid link chain while its parent xact is still running.  However,
it is unsafe to do that unless you know for certain that the xact in
question has no snapshots that could see the tuple as live.  VACUUM
certainly doesn't know that, and neither does pruneheap.c, and I don't
really foresee us introducing enough bookkeeping so that they would know
it.  (If we did try to do that, we could handle the problem by
considering that queueing of trigger events introduces a quasi-snapshot
that requires the relevant tuples to remain available.)

So I think this is probably OK as long as it's adequately documented in
the code.  Just for luck, though, we should add an xmin/cmin match check
to the code if there's not one already.

However, this means that Dean is not simply adding some self-contained
compression logic; he's eliminating information from the data structure
on the grounds that he can get it from elsewhere.  I think that that
ought to be treated as a separate patch, and that the costs/benefits
of the "compressed" data structure ought to be evaluated relative to the
situation with the second CTID removed but the data structure not
otherwise changed.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Compressing the AFTER TRIGGER queue
Next
From: Merlin Moncure
Date:
Subject: Re: Access to current database from C-language function