Re: Faster data type for one-length values

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: André Volpato <andre(dot)volpato(at)ecomtecnologia(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Faster data type for one-length values
Date: 2007-05-23 15:22:26
Message-ID: 20070523152226.GQ4642@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

André Volpato wrote:

> The ammount of space saved seems pretty clear to me.

Yeah, zero most of the time due to alignment.

> What are you saying is that the index behaviour is the same, for all
> types smaller than 4 bytes ? For query performance, in a search is
> based on that standalone indexed field, would be any difference using :
>
> a. char(1) ; b. int2; c. "char"

char(1) takes at least five bytes (more if the char is multibyte), so it
would be slower than the other two, ceteris paribus.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-05-23 15:47:40 Re: [GENERAL] OIDs - file objects, are damaged by PostgreSQL.
Previous Message Rick Schumeyer 2007-05-23 15:08:32 Tsearch2: upgrading from postgres 8.1.x to 8.2.x