Re: NUMERIC x VARCHAR

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: NUMERIC x VARCHAR
Дата
Msg-id 1092205308.27166.358.camel@localhost.localdomain
обсуждение исходный текст
Ответ на NUMERIC x VARCHAR  (Er Galvão Abbott <galvao@galvao.eti.br>)
Ответы Re: NUMERIC x VARCHAR  (Jan Wieck <JanWieck@Yahoo.com>)
Список pgsql-performance
On Tue, 2004-08-10 at 23:42, Er Galvão Abbott wrote:
> Greetings.
>
> I have a question regarding performance of certain datatypes:
>
> I have a field where I will store my clients phone numbers. I know
> that this field will never exceed 15 characters, and I will store only
> numbers here (no dashes, dots, etc...), so I was wondering:
>
> Wich type is faster: NUMERIC(15,0) or VARCHAR(15)? Are there any
> storage differences between them?

Since numerics are stored as text strings, the storage would be
similar.  Numerics, however, may be slower since they have more
constraints built in.  If you throw a check constraint on the
varchar(15) then it will likely be about the same speed for updating.

text type with a check contraint it what i'd use.  That way if you want
to change it at a later date you just drop and recreate your constraint.


В списке pgsql-performance по дате отправления:

Предыдущее
От: Er Galvão Abbott
Дата:
Сообщение: NUMERIC x VARCHAR
Следующее
От: Pierre-Frédéric Caillaud
Дата:
Сообщение: Re: Hardware upgrade for a high-traffic database