Re: Converting MySQL tinyint to PostgreSQL

From: Joe <svn(at)freedomcircle(dot)net>
To: Dawid Kuroczko <qnex42(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Converting MySQL tinyint to PostgreSQL
Date: 2005-07-12 20:59:32
Message-ID: 42D42F34.40809@freedomcircle.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dawid Kuroczko wrote:
> smallint takes two bytes. Numeric(1) will take around 10 bytes and char(1) will
> take 5 bytes (4 bytes for length of data).

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? I'm also
surprised --albeit less-- about the NUMERIC(1) overhead. Is any of this
discussed in the Internals chapters? I didn't see this discussed elsewhere.

As a perhaps-related aside, I've noticed several examples which declare string
types as 'text', rather than VARCHAR or CHAR, the former being non-SQL standard.
Is there some performance benefit to using 'text' (other than it being shorter
to type :-) or is it just the "usual Postgres way"?

Joe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Harry Mantheakis 2005-07-12 21:05:52 Re: Japanese words not distinguished
Previous Message Greg Patnude 2005-07-12 20:55:45 Re: Checkpoints are occurring too frequently...