Re: Index only scan and ctid

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Index only scan and ctid
Date: 2020-02-18 14:21:51
Message-ID: 28944.1582035711@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <stark(at)mit(dot)edu> writes:
> For the user visible ctid we could just arbitrarily declare that the ctid
> returned by an IOS is the head of the HOT update chain instead of the tail.

No, I don't think that'd work at all, because that tuple might be dead.
A minimum expectation is that "SELECT ... WHERE ctid = 'xxx'" would return
the same data as the IOS, and that would fail because it wouldn't return
anything.

(In principle I suppose we could *also* redefine what selecting by ctid
means. Doubt I want to go there though.)

> For a data modifying query -- and it would have to be one targeting some
> other table or else there's no way it could be an IOS -- does having a ctid
> for the head rather than the tail still work?

If you target a tuple that is live according to your current snapshot,
but nonetheless out-of-date, EPQ will chase up to the head for you.
But you gotta start with a tuple that is visible to your snapshot.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2020-02-18 14:38:13 Re: Parallel copy
Previous Message Mike Blackwell 2020-02-18 14:21:43 Re: Parallel copy