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

Re: HOT WIP Patch - version 3.2

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: HOT WIP Patch - version 3.2
Date: 2007-02-27 13:34:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Pavan Deolasee wrote:
> - What do we do with the LP_DELETEd tuples at the VACUUM time ?
> In this patch, we are collecting them and vacuuming like
> any other dead tuples. But is that the best thing to do ?

Since they don't need index cleanups, it's a waste of 
maintenance_work_mem to keep track of them in the dead tuples array. 
Let's remove them in the 1st phase. That means trading the shared lock 
for a vacuum-level lock on pages with LP_DELETEd tuples. Or if we want 
to get fancy, we could skip LP_DELETEd tuples in the 1st phase for pages 
that had dead tuples on them, and scan and remove them in the 2nd phase 
when we have to acquire the vacuum-level lock anyway.

> - While searching for a LP_DELETEd tuple, we start from the
> first offset and return the first slot which is big enough
> to store the tuple. Is there a better search algorithm
> (sorting/randomizing) ? Should we go for best-fit instead
> of first-fit ?

Best-fit seems better to me. It's pretty cheap to scan for LP_DELETEd 
line pointers, but wasting space can lead to cold updates and get much 
more expensive.

You could also prune the chains on the page to make room for the update, 
and if you can get a vacuum lock you can also defrag the page.

> - Should we have metadata on the heap page to track the
> number of LP_DELETEd tuples, number of HOT-update chains in the
> page and any other information that can help us optimize
> search/prune operations ?

I don't think the CPU overhead is that significant; we only need to do 
the search/prune when a page gets full. We can add flags later if we 
feel like it, but let's keep it simple for now.

> - There are some interesting issues in the VACUUMing area. How
> do we count the dead tuples ? Should we count HOT-updated
> tuples in the dead count ? If we do so, I noticed that
> VACUUM gets triggered on very small tables like "tellers"
> in pgbench and takes several minutes to finish because
> it waits very very long for VACUUM-strength lock on the
> index pages. Index is just a page or two in this case.

Yeah, that's not good. HOT updates shouldn't increase the n_dead_tuples 
pgstat counter.

   Heikki Linnakangas

In response to


pgsql-hackers by date

Next:From: Chad WagnerDate: 2007-02-27 13:41:51
Subject: Re: Developer TODO List as a PostgreSQL DB
Previous:From: Heikki LinnakangasDate: 2007-02-27 11:03:12
Subject: Re:

pgsql-patches by date

Next:From: Michael MeskesDate: 2007-02-27 13:47:25
Subject: Re: patch for ECPG (BUG #2956: ECPG does not treat multibyte characters correctly.)
Previous:From: Zdenek KotalaDate: 2007-02-27 12:42:24
Subject: Re: [PATCHES] BUG #2969: Inaccuracies in Solaris FAQ

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