Re: Converting MySQL tinyint to PostgreSQL - Mailing list pgsql-general

From Tom Lane
Subject Re: Converting MySQL tinyint to PostgreSQL
Date
Msg-id 25840.1121202916@sss.pgh.pa.us
Whole thread Raw
In response to Re: Converting MySQL tinyint to PostgreSQL  (Joe <svn@freedomcircle.net>)
Responses Re: Converting MySQL tinyint to PostgreSQL
List pgsql-general
Joe <svn@freedomcircle.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

pgsql-general by date:

Previous
From: Joe
Date:
Subject: Re: Converting MySQL tinyint to PostgreSQL
Next
From: Marco Gaiarin
Date:
Subject: 7.2 -> 7.4: horrible performance hit!