Re: HOT for PostgreSQL 8.3

From: "Zeugswetter Andreas ADI SD" <ZeugswetterA(at)spardat(dot)at>
To: "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com>
Cc: "Simon Riggs" <simon(at)2ndquadrant(dot)com>, "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>, "Hannu Krosing" <hannu(at)skype(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>, "Pavan Deolasee" <pavan(dot)deolasee(at)enterprisedb(dot)com>, "Nikhil S" <nikhil(dot)sontakke(at)enterprisedb(dot)com>
Subject: Re: HOT for PostgreSQL 8.3
Date: 2007-02-22 18:05:43
Message-ID: E1539E0ED7043848906A8FF995BDA57901CAF729@m0143.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> I think the word "line pointer" is causing some confusion
> here. Let me explain the idea again: Each page has a set of
> line pointers OR item-ids as they are referred in the code (I
> shall use the word item-id here after).
> The item-id stores the offset(15 bits), length (15 bits) and
> two flags, LP_USED and LP_DELETE (2 bits).
>
> The root tuple is pointed to by some item-id (say, I1) on the
> page. When the tuple is hot updated, a heap-only tuple is
> added which is linked to the root tuple by its t_ctid and is
> pointed by another item-id I2 on the page.
>
> Now, when the root tuple subsequently becomes DEAD, I am
> proposing to store I2 in the offset field of I1. The length
> field in I1 can be set to zero (or some other special value)
> to mark that I1 is now just a redirection to I2 and does not
> point to any real tuple, dead or live.

Oh, thanks for explaining. I was really misunderstanding.
Is that possible ? I thought item-id's (slots) need to be in physical
order.

> If we do reuse dead tuples without vacuum we should probably,
> as already
> > suggested,
> > disconnect the "what is dead enough for reuse/vacuum" from
> global xmin
> > right from the start.
>
>
> I did not get that completely. Can you elaborate on that ?
>
> Once we find a heap-only DEAD tuple, we remove it from the
> tuple-chain (and thus remove its only reference) and set LP_DELETE
> on its item-id. When we run out of free-space in a page, we search for
> an item-id whose LP_DELETE is set and whose length is atleast equal
> to the new tuple length. We reuse that item-id and the associated
> storage for storing the new tuple.

With the recent discussion about flashback (explicitly setting a
snapshot
to 5 min ago) and forensics, I think we should have a way to delay
what is considered "DEAD and available for immediate reuse".
I know this can reduce the efficiency of HOT when delayed too far,
but I think we should have that possibility if we reuse without vacuum.

Andreas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2007-02-22 18:11:33 Re: tsearch in core patch, for inclusion
Previous Message Joshua D. Drake 2007-02-22 18:03:28 Re: tsearch in core patch, for inclusion