Re: index only scan question

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Daniel Westermann <daniel(dot)westermann(at)dbi-services(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: index only scan question
Date: 2018-11-09 15:51:33
Message-ID: 3053c9cec512260c53e4f48cab370a295b6ff4af.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Daniel Westermann wrote:
> >I'd say the old index tuple was killed during the first scan:
> >https://www.cybertec-postgresql.com/en/killed-index-tuples/
>
> ... from your blog: "Whenever an index scan fetches a heap tuple only to find that it is dead
> (that the entire “HOT chain” of tuples is dead, to be more precise), it marks the index tuple
> as “killed”. Then future index scans can simply ignore it.
>
> I understand that, but in my case the chain is not dead so this does not explain the difference.
> Do I miss something?

I assume that the UPDATE was not HOT, because the first scan had to fetch two tuples.

After the UPDATE, the original tuple was dead (the HOT chain consists
only of a single tuple here, because it was no HOT update).
The first index scan detects that and marks the index tuple as killed.
The second index scan only visits the new tuple.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Marc Lessard 2018-11-09 23:49:24 pg_dump out of memory for large table with LOB
Previous Message Daniel Westermann 2018-11-09 14:59:29 Re: index only scan question