pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Xiaoran Wang <fanfuxiaoran@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Subject: Re: Recovering from detoast-related catcache invalidations
Date: Sat, 13 Jan 2024 14:12:23 -0500
Message-ID: <1041875.1705173143@sss.pgh.pa.us> (raw)
In-Reply-To: <966599.1705166312@sss.pgh.pa.us>
References: <CAGjhLkOoBEC9mLsnB42d3CO1vcMx71MLSEuigeABbQ8oRdA6gw@mail.gmail.com>
	<329632.1705011663@sss.pgh.pa.us>
	<CAGjhLkOFmzx9gbB8qudKxdg8UR0SApo-thKuPZ=1zJaZ6-ORXQ@mail.gmail.com>
	<754826.1705090452@sss.pgh.pa.us>
	<793469.1705092433@sss.pgh.pa.us>
	<CAGjhLkMN1ZnYdyhmHxBtXV9=QhRCEQR=TQecibC1Y9uT0aytqA@mail.gmail.com>
	<CAGjhLkMzm=+z=VJedZ5Zi2FFDjj+nXqx4cKfTOryZ+tQYpL8jw@mail.gmail.com>
	<966599.1705166312@sss.pgh.pa.us>

I wrote:
> Xiaoran Wang <fanfuxiaoran@gmail.com> writes:
>> Hmm, how about first checking if any invalidated shared messages have been
>> accepted, then rechecking the tuple's visibility?
>> If there is no invalidated shared message accepted during
>> 'toast_flatten_tuple',
>> there is no need to do then visibility check, then it can save several
>> CPU cycles.

> Meh, I'd just as soon not add the additional dependency/risk of bugs.
> This is an expensive and seldom-taken code path, so I don't think
> shaving a few cycles is really important.

It occurred to me that this idea might be more interesting if we
could encapsulate it right into systable_recheck_tuple: something
like having systable_beginscan capture the current
SharedInvalidMessageCounter and save it in the SysScanDesc struct,
then compare in systable_recheck_tuple to possibly short-circuit
that work.  This'd eliminate one of the main bug hazards in the
idea, namely that you might capture SharedInvalidMessageCounter too
late, after something's already happened.  However, the whole idea
only works for catalogs that have catcaches, and the other users of
systable_recheck_tuple are interested in pg_depend which doesn't.
So that put a damper on my enthusiasm for the idea.

			regards, tom lane





view thread (28+ messages)  latest in thread

Message-ID: <1041875.1705173143@sss.pgh.pa.us>
Permalink:  ../1041875.1705173143@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1041875.1705173143@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, fanfuxiaoran@gmail.com, andres@anarazel.de
  Subject: Re: Recovering from detoast-related catcache invalidations
  In-Reply-To: <1041875.1705173143@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox