Rewritten rows on unchanged values

From: Bertrand Janin <b(at)janin(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Rewritten rows on unchanged values
Date: 2013-03-22 12:32:54
Message-ID: 20130322123254.GA21592@tamentis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I noticed how rows were re-written to a different location (new ctid) even
without changes to the values. This illustrate what I mean:

CREATE TABLE demo (id serial, value text);

-- generate a few pages of dummy data
INSERT INTO demo (value)
SELECT md5(s.a::text)
FROM generate_series(1, 1000) AS s(a);

-- ctid = (0,1)
SELECT id, xmin, ctid, value
FROM demo
WHERE id = 1;

UPDATE demo
SET value = value
WHERE id = 1;

-- ctid = (8,41)
SELECT id, xmin, ctid, value
FROM demo
WHERE id = 1;

I'm curious as to what would prevent keeping the row where it is and maybe
change xmin in place?

Thanks,
-b

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2013-03-22 13:16:11 Re: Rewritten rows on unchanged values
Previous Message Juraj Fabo 2013-03-22 11:58:15 Why is pg_xlog/archive_status of HotStandby synced with master?