Re: Why latestRemovedXid|cuteoff_xid are always sent? - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Why latestRemovedXid|cuteoff_xid are always sent?
Date
Msg-id CAH2-WzkfNn1J_G=Y0LOgTH4ZSDO53hL60d3f+G-MqCuMS9hy7g@mail.gmail.com
Whole thread Raw
In response to Re: Why latestRemovedXid|cuteoff_xid are always sent?  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: Why latestRemovedXid|cuteoff_xid are always sent?  (Michail Nikolaev <michail.nikolaev@gmail.com>)
List pgsql-hackers
On Sat, Jan 2, 2021 at 3:22 PM Peter Geoghegan <pg@bowt.ie> wrote:
> Of course, it's possible that the question of whether or not it's
> worth it has been misjudged for any given case. And maybe these
> particular WAL records are one such case where somebody got it wrong,
> affecting a real workload (I am ignoring the complexity of making it
> work for latestRemovedXid in particular for now).

BTW, what I notice with xl_btree_delete records on the master branch
is that the latestRemovedXid value in the WAL record is almost always
InvalidTransactionId ("conflict definitely unnecessary"). And even
when it isn't, the actual xid is usually much older than what we see
for nearby pruning records.

However, with the bottom-up deletion patch that I plan on committing
soon, the situation changes quite a bit. We're now regularly in a
position to delete index tuples that became dead-to-all just moments
earlier, which in practice means that there is a very high chance that
there hasn't been a heap prune for at least one or two affected heap
tuples. Now the latestRemovedXid field in xl_btree_delete can be a
relatively recent XID, which is very similar to what we see in nearby
xl_heap_clean/XLOG_HEAP2_CLEAN records. In fact there are *hardly any*
InvalidTransactionId/0 values for the xl_btree_delete latestRemovedXid
field. They become very rare, having been very common.

In short: Your intuition that the xl_btree_delete record's
latestRemovedXid value is usually not needed anyway seems correct to
me. However, that won't be true for much longer, and ISTM that this
factor eliminates any opportunity for WAL space optimizations of the
kind you were contemplating.

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Cirrus CI (Windows help wanted)
Next
From: Stephen Frost
Date:
Subject: Re: data_checksums enabled by default (was: Move --data-checksums to common options in initdb --help)