Re: Reducing the overhead of NUMERIC data

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reducing the overhead of NUMERIC data
Date: 2005-11-03 14:49:09
Message-ID: 1131029349.8300.1925.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Thu, 2005-11-03 at 11:13 -0300, Alvaro Herrera wrote:
> Simon Riggs wrote:
> > On PostgreSQL, CHAR(12) is a bpchar datatype with all instantiations of
> > that datatype having a 4 byte varlena header. In this example, all of
> > those instantiations having the varlena header set to 12, so essentially
> > wasting the 4 byte header.
>
> We need the length word because the actual size in bytes is variable,
> due to multibyte encoding considerations.

Succinctly put, thanks.

Incidentally, you remind me that other databases do *not* vary the
character length, even if they do have varying length UTF-8 within them.
So if you define CHAR(255) then it could blow up at a random length if
you store UTF-8 within it.

That's behaviour that I could never sanction, so I'll leave this now.

Best Regards, Simon Riggs

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2005-11-03 15:03:05 Re: Reducing the overhead of NUMERIC data
Previous Message Alvaro Herrera 2005-11-03 14:13:58 Re: Reducing the overhead of NUMERIC data

Browse pgsql-patches by date

  From Date Subject
Next Message Stephan Szabo 2005-11-03 15:03:05 Re: Reducing the overhead of NUMERIC data
Previous Message Alvaro Herrera 2005-11-03 14:13:58 Re: Reducing the overhead of NUMERIC data