Remove xmin and cmin from frozen tuples

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Remove xmin and cmin from frozen tuples
Date: 2005-09-01 01:45:44
Message-ID: 20050901103648.4E4B.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

I think it would be a waste to retain xmin and cmin for frozen tuples
because their values represent only 'visible for all transactions'.
Additionally, most tuples in database can be frozen potentially.

I wrote a makeshift patch to compress xmin and cmin (8bytes) to
1-bit flag, using tuple overlaping.

Is this idea worth trying?

Also, it will be useful to combine it and more aggressive freeze vacuum,
for example, a freezer integrated with bgwriter.

(The following is test of the attached patch)

* Test query
1. create table test (a int);
2. insert into test select * from generate_series(1, 100000);
3. update test set a = a where a % 100 = 0; # to force defrag
4. select * from pgstattuple('test');
5. vacuum freeze test;
6. select * from pgstattuple('test');

* Results of pgstattuple

-[ before vacuum ]-+--------
table_len | 3645440
tuple_count | 100000
tuple_len | 3200000
tuple_percent | 87.78
dead_tuple_count | 1000
dead_tuple_len | 32000
dead_tuple_percent | 0.88
free_space | 536
free_percent | 0.01

-[ 8.1beta1 orig ]-+--------
table_len | 3645440
tuple_count | 100000
tuple_len | 3200000
tuple_percent | 87.78
dead_tuple_count | 0
dead_tuple_len | 0
dead_tuple_percent | 0
free_space | 30772 <-- about 32byte * 1000 (dead tuples)
free_percent | 0.84

-[ patched ]-------+--------
table_len | 3645440
tuple_count | 100000
tuple_len | 3200000
tuple_percent | 87.78
dead_tuple_count | 0
dead_tuple_len | 0
dead_tuple_percent | 0
free_space | 823628 <-- + 8byte * 100000 (whole tuples)
free_percent | 22.59

---
ITAGAKI Takahiro
NTT Cyber Space Laboratories

Attachment Content-Type Size
xmincut.patch application/octet-stream 8.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2005-09-01 01:48:04 Re: Minimally avoiding Transaction Wraparound in VLDBs
Previous Message Jaime Casanova 2005-09-01 01:42:23 TODO item: set proper permissions on non-system schemas