Re: Converting MySQL tinyint to PostgreSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe <svn(at)freedomcircle(dot)net>
Cc: Dawid Kuroczko <qnex42(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Converting MySQL tinyint to PostgreSQL
Date: 2005-07-12 21:15:16
Message-ID: 25840.1121202916@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joe <svn(at)freedomcircle(dot)net> writes:
> I never would've imagined *that* amount of overhead for CHAR(1)! I
> would've imagined that it would take up one byte (or two with a NULL
> indicator). After all, we're not talking about VARCHAR(1) [which is
> sort of useless]. Don't the catalogs know the declared length and if
> so, why the length overhead?

Because the length specification is in *characters*, which is not by any
means the same as *bytes*.

We could possibly put enough intelligence into the low-level tuple
manipulation routines to count characters in whatever encoding we happen
to be using, but it's a lot faster and more robust to insist on a count
word for every variable-width field.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-07-12 21:21:57 Re: Checkpoints are occurring too frequently...
Previous Message Scott Marlowe 2005-07-12 21:09:11 Re: Checkpoints are occurring too frequently...