Search Postgresql Archives

Re: Converting MySQL tinyint to PostgreSQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux