pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: pgsql: Compute XID horizon for page level index vacuum on primary.
Date: Fri, 29 Mar 2019 09:32:25 -0700
Message-ID: <20190329163225.5edm2bpi34hwbgcq@alap3.anarazel.de> (raw)
In-Reply-To: <CANP8+jLMd_aexQbZ3y0oiq0sWZcR7S_Ks2KnaMBbrEnKwKHF0Q@mail.gmail.com>
References: <E1h8w5d-0006c7-16@gemulon.postgresql.org>
	<CANP8+jKUF-DE9um44zEfxOY277byx3b4NMFrY+gwj=+=Yc=0wQ@mail.gmail.com>
	<20190329152906.356icmttz7yjgsyh@alap3.anarazel.de>
	<CANP8+jLEWNQX9oW0RQPPvOXFOh3zEBUdC62QWZ2GLNkeZmXnPA@mail.gmail.com>
	<20190329161238.eyrmdtofbzmapvyv@alap3.anarazel.de>
	<CANP8+jLMd_aexQbZ3y0oiq0sWZcR7S_Ks2KnaMBbrEnKwKHF0Q@mail.gmail.com>

On 2019-03-29 16:20:54 +0000, Simon Riggs wrote:
> On Fri, 29 Mar 2019 at 16:12, Andres Freund <andres@anarazel.de> wrote:
> 
> 
> > On 2019-03-29 15:58:14 +0000, Simon Riggs wrote:
> > > On Fri, 29 Mar 2019 at 15:29, Andres Freund <andres@anarazel.de> wrote:
> > > > That's far from a trivial feature imo. It seems quite possible that
> > we'd
> > > > end up with increased overhead, because the current logic can get away
> > > > with only doing hint bit style writes - but would that be true if we
> > > > started actually replacing the item pointers? Because I don't see any
> > > > guarantee they couldn't cross a page boundary etc? So I think we'd need
> > > > to do WAL logging during index searches, which seems prohibitively
> > > > expensive.
> > > >
> > >
> > > Don't see that.
> > >
> > > I was talking about reusing the first 4 bytes of an index tuple's
> > > ItemPointerData,
> > > which is the first field of an index tuple. Index tuples are MAXALIGNed,
> > so
> > > I can't see how that would ever cross a page boundary.
> >
> > They're 8 bytes, and MAXALIGN often is 4 bytes:
> >
> 
> xids are 4 bytes, so we're good.

I literally went on to explain why that's not sufficient? You can't
*just* replace the block number with an xid. You *also* need to set a
flag denoting that it's an xid and dead now. Which can't fit in the same
4 bytes.  You either have to set it in the IndexTuple's t_info, or or in
the ItemIdData's lp_flags. And both can be on a different sectors.  If
the flag persists, and the xid doesn't you're going to interpret a block
number as an xid - not great; but even worse, if the xid survives, but
the flag doesn't, you're going to access the xid as a block - definitely
not ok, because you're going to return wrong results.

Greetings,

Andres Freund





view thread (30+ messages)  latest in thread

Message-ID: <20190329163225.5edm2bpi34hwbgcq@alap3.anarazel.de>
Permalink:  ../20190329163225.5edm2bpi34hwbgcq@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20190329163225.5edm2bpi34hwbgcq@alap3.anarazel.de

 · 

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-committers@postgresql.org
  Cc: andres@anarazel.de, simon@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: pgsql: Compute XID horizon for page level index vacuum on primary.
  In-Reply-To: <20190329163225.5edm2bpi34hwbgcq@alap3.anarazel.de>
  References: <E1h8w5d-0006c7-16@gemulon.postgresql.org> <CANP8+jKUF-DE9um44zEfxOY277byx3b4NMFrY+gwj=+=Yc=0wQ@mail.gmail.com> <20190329152906.356icmttz7yjgsyh@alap3.anarazel.de> <CANP8+jLEWNQX9oW0RQPPvOXFOh3zEBUdC62QWZ2GLNkeZmXnPA@mail.gmail.com> <20190329161238.eyrmdtofbzmapvyv@alap3.anarazel.de> <CANP8+jLMd_aexQbZ3y0oiq0sWZcR7S_Ks2KnaMBbrEnKwKHF0Q@mail.gmail.com> <20190329163225.5edm2bpi34hwbgcq@alap3.anarazel.de>

* 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