Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] HOT WIP Patch - version 2

From: "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com>
To: "Hannu Krosing" <hannu(at)skype(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] HOT WIP Patch - version 2
Date: 2007-02-20 08:10:50
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
On 2/20/07, Hannu Krosing <hannu(at)skype(dot)net> wrote:
> Ühel kenal päeval, T, 2007-02-20 kell 12:08, kirjutas Pavan Deolasee:
> What do you do, if there are no live tuples on the page ? will this
> un-HOTify the root and free all other tuples in HOT chain ?

Yes. The HOT-updated status of the root and all intermediate
tuples is cleared and their respective ctid pointers are made
point to themselves. The index entry will be marked LP_DELETE
as with the normal case. VACUUM can subsequently reclaimed these
tuples, along with the index entry.

> >
> > The intermediate heap-only tuples are  removed from the HOT-update
> > chain.
> > The HOT-updated status of these tuples is cleared and their respective
> > t_ctid are made point to themselves. These tuples are not reachable
> > now and ready for vacuuming.
> Does this mean, that they are now indistinguishable from ordinary
> tuples ?

No. HEAP_ONLY_TUPLE flag is still set on these tuples. So you
can distinguish those tuples.

Maybe they could be freed right away instead of changing HOT-updated
> status and ctid ?

Yeah, thats a good idea. I am thinking of setting LP_DELETE flag on them
while pruning. The tuple then can be reused for next in-page HOT-update.

> > When we run out space for update-within-the-block, we traverse
> > through all the line pointers looking for LP_DELETEd items. If any of
> > these
> > items have space large enough to store the new tuple, that item is
> > reused.
> > Does anyone see any issue with doing this ? Also, any suggestions
> > about doing it in a better way ?
> IIRC the size is determined by the next tuple pointer, so you can store
> new data without changing tuple pointer only if they are exactly the
> same size.

There is a lp_len field in the line pointer to store the length of the
tuple. ISTM that we can reduce that while reusing the line pointer. But
that would create a permanent hole in the page.

> > we are
> > more concerned about the large tables, the chances of being able to
> > upgrade
> > the exclusive lock to vacuum-strength lock are high. Comments ?
> I'm not sure about the "we are more concerned about the large tables"
> part. I see it more as a device for high-update tables. This may not
> always be the same as "large", so there should be some fallbacks for
> case where you can't get the lock. Maybe just give up and move to
> another page ?
Oh, yes. I agree. The fallback option of doing COLD update always




In response to


pgsql-hackers by date

Next:From: Magnus HaganderDate: 2007-02-20 08:24:38
Subject: Re: pg_proc without oid?
Previous:From: Guillaume SmetDate: 2007-02-20 08:03:27
Subject: Re: WIP patch - INSERT-able log statements

pgsql-patches by date

Next:From: Zoltan BoszormenyiDate: 2007-02-20 10:27:42
Subject: New version of IDENTITY/GENERATED
Previous:From: Guillaume SmetDate: 2007-02-20 08:03:27
Subject: Re: WIP patch - INSERT-able log statements

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group