Pruning never visible changes - Mailing list pgsql-hackers

From Simon Riggs
Subject Pruning never visible changes
Date
Msg-id CANbhV-Hhc+-A9OU6m4_-UmrFVg3urgJif-MTtETTkZORkXeqPQ@mail.gmail.com
Whole thread Raw
Responses Re: Pruning never visible changes
List pgsql-hackers
A user asked me whether we prune never visible changes, such as

BEGIN;
INSERT...
UPDATE.. (same row)
COMMIT;

Once committed, the original insert is no longer visible to anyone, so
"ought to be able to be pruned", sayeth the user. And they also say
that changing the app is much harder, as ever.

After some thought, Yes, we can prune, but not in all cases - only if
the never visible tuple is at the root end of the update chain. The
only question is can that be done cheaply enough to bother with. The
answer in one specific case is Yes, in other cases No.

This patch adds a new test for this use case, and code to remove the
never visible row when the changes are made by the same xid.

(I'm pretty sure there used to be a test for this some years back and
I'm guessing it was removed because it isn't always possible to remove
the tuple, which this new patch honours.)

Please let me know what you think.

--
Simon Riggs                http://www.EnterpriseDB.com/

Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: SUBTRANS: Minimizing calls to SubTransSetParent()
Next
From: Japin Li
Date:
Subject: Re: Error for WITH options on partitioned tables