Re: Dead Space Map - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Dead Space Map
Date
Msg-id 200602281812.k1SICfc10337@candle.pha.pa.us
Whole thread Raw
In response to Re: Dead Space Map  (Greg Stark <gsstark@mit.edu>)
Responses Re: Dead Space Map  (Greg Stark <gsstark@mit.edu>)
List pgsql-hackers
Greg Stark wrote:
> 
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> 
> > I should be clearer.  Suppose you have a table with a single index on
> > the primary key.  You are updating the row over and over again (a
> > typical case).  You create the first row, commit, then it is updated
> > (two copies), commit, then you update it again.  That first created row
> > might not be visible to anyone, but has the same index value as the new
> > row you are about to add.  Why not reused that heap tuple?
> 
> If you commit each update then your tuple might well be visible to other
> transactions, how would you check that?

You check the xmin/xmax using standard visibility rules.

> I originally thought you meant if you are repeatedly updating the same record
> within the same transaction. In that case sure you could reuse the space but
> a) only if it's big enough for the new record and b) how often do you really
> do that?

Right, that is a rare case.

--  Bruce Momjian   http://candle.pha.pa.us SRA OSS, Inc.   http://www.sraoss.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Dead Space Map
Next
From: "Kevin Grittner"
Date:
Subject: Re: [PERFORM] temporary indexes