Re: About varlena2

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: About varlena2
Date: 2005-12-06 01:00:17
Message-ID: 20051206085459.4970.ITAGAKI.TAKAHIRO@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu> wrote:

> To reduce size of varlen2.vl_len to int16. This has been mentioned before,
> but is there any show-stopper reasoning preventing us from doing that or
> somebody has been working on it?

Hi, I'm rewriting the patch that I proposed before.
(http://archives.postgresql.org/pgsql-hackers/2005-09/msg00421.php)
This is another way to reduce the size of variable length types,
using variable length headers.

I'm sure that there are pros and cons of this approach.
Pros.
- Optimized for short variables (length <= 127),
where the header takes only one byte.
- It can represent long data.
Cons.
- More complexity and operations to extract lengths and buffers.
- Needs more works to support TOAST.

To support TOAST, I think the following representations.
It might be good to use only A and B, if TOAST is not needed.

| Representation | Size | Mode |
--+----------------------------+-------+---------------------+
A | 0******* + data | 1 + n | length <= 127 |
B | 10****** + 1 byte + data | 2 + n | length <= 16K -1 |
C | 110----- + 4 bytes + data | 5 + n | length <= 4G -1 |
D | 1110---- + 6 bytes + data | 7 + n | Compressed |
E | 11110--- + 12 bytes | 13 | External |
F | 11111--- + 16 bytes | 17 | External+Compressed |
('*' bits are used for length, '-' are unused.)

Comments welcome,
---
ITAGAKI Takahiro
NTT Cyber Space Laboratories

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gustavo Tonini 2005-12-06 01:18:50 Re: Replication on the backend
Previous Message Chris Browne 2005-12-05 23:26:51 Re: Replication on the backend