Re: what data type to store fixed size integer?

From: Arash pajoohande <apajoohande(at)gmail(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: what data type to store fixed size integer?
Date: 2011-04-12 05:32:25
Message-ID: BANLkTi=MiZwKzNr_psPXo+=9RFYQfzpVkg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

@Dave

On Mon, Apr 11, 2011 at 9:18 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:

> >>>> the data type does not need any arithmetic operations (as of
> integers).
>
>
>
> You arguably do not have a number but simply a string that looks like a
> number. Other examples are zip-codes and phone-numbers if you ignore
> symbols. Thus you should probably use an appropriately sized char/varchar.
>
>
Do you think using char/varchar which in this case will take about 20 bytes
for each entry is more proper than using bigint with only 4 bytes?

>
> Just something to consider; there is no hard and fast rule about this kind
> of thing. If you can think of any logical use of arithmetic operators, even
> if you do not need them now, you should use an integer.
>
The data is some kind of identifiers. I don't think they will need any kind
of arithmetic operators at all :)

thank you in advance

Arash

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Uwe Schroeder 2011-04-12 05:58:01 Re: Why is 8.4 and 9.0 so much slower on some queries?
Previous Message Tom Lane 2011-04-12 04:57:22 Re: Why is 8.4 and 9.0 so much slower on some queries?