pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Daniel Westermann <daniel.westermann@dbi-services.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: index only scan question
Date: Fri, 09 Nov 2018 16:51:33 +0100
Message-ID: <3053c9cec512260c53e4f48cab370a295b6ff4af.camel@cybertec.at> (raw)
In-Reply-To: <AM4PR0901MB134677E9C9F2664B890F4763D2C60@AM4PR0901MB1346.eurprd09.prod.outlook.com>
References: <AM4PR0901MB1346BBF200903002F6E74539D2C60@AM4PR0901MB1346.eurprd09.prod.outlook.com>
	<96183def4b971c718367fdbc6021f6b9706f03ea.camel@cybertec.at>
	<AM4PR0901MB13460A857081987E4733CCBED2C60@AM4PR0901MB1346.eurprd09.prod.outlook.com>
	<AM4PR0901MB134677E9C9F2664B890F4763D2C60@AM4PR0901MB1346.eurprd09.prod.outlook.com>

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





view thread (8+ messages)

Message-ID: <3053c9cec512260c53e4f48cab370a295b6ff4af.camel@cybertec.at>
Permalink:  ../3053c9cec512260c53e4f48cab370a295b6ff4af.camel@cybertec.at/
Also on:    postgresql.org/message-id/3053c9cec512260c53e4f48cab370a295b6ff4af.camel@cybertec.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, daniel.westermann@dbi-services.com
  Subject: Re: index only scan question
  In-Reply-To: <3053c9cec512260c53e4f48cab370a295b6ff4af.camel@cybertec.at>
  References: <AM4PR0901MB1346BBF200903002F6E74539D2C60@AM4PR0901MB1346.eurprd09.prod.outlook.com> <96183def4b971c718367fdbc6021f6b9706f03ea.camel@cybertec.at> <AM4PR0901MB13460A857081987E4733CCBED2C60@AM4PR0901MB1346.eurprd09.prod.outlook.com> <AM4PR0901MB134677E9C9F2664B890F4763D2C60@AM4PR0901MB1346.eurprd09.prod.outlook.com> <3053c9cec512260c53e4f48cab370a295b6ff4af.camel@cybertec.at>

* 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