Re: datatype advice numeric vs. varchar
От
Michael Glaesemann
Тема
Re: datatype advice numeric vs. varchar
Дата
Msg-id
B4CFC8C3-ADFF-49E5-8963-59BE812B6777@seespotcode.net
Ответ на
Список
Дерево обсуждения
datatype advice numeric vs. varchar Gene <genekhart@gmail.com>
Re: datatype advice numeric vs. varchar Martijn van Oosterhout <kleptog@svana.org>
Re: datatype advice numeric vs. varchar Gene <genekhart@gmail.com>
Re: datatype advice numeric vs. varchar "shakahshakah@gmail.com" <shakahshakah@gmail.com>
Re: datatype advice numeric vs. varchar Tino Wildenhain <tino@wildenhain.de>
Re: datatype advice numeric vs. varchar Michael Glaesemann <grzm@seespotcode.net>
Re: datatype advice numeric vs. varchar Ron Johnson <ron.l.johnson@cox.net>
On Jan 18, 2007, at 15:15 , Gene wrote: > My calculations for disk space based off some information i found > online are ( 8 + ( 2 bytes for every four digits) ) for numeric and ( > 4 + number of chars ) for a utf8 varchar datatype. Are these > calculations still valid and has anyone tried using numeric for this > purpose or is this really stupid? While telephone numbers typically consist of digits, they're not numbers: they're strings of digits. For example, a telephone number in Tokyo is (typically) a string of 10 digits, beginning with "03". 0311111111 as numeric would have unexpected results when retrieved. While you may not be concerned with Japanese phone numbers, I use it as an example to show that telephone "numbers" are actually strings. In short, use strings (text/varchar). Michael Glaesemann grzm seespotcode net PS. The number of bytes used to represent characters in UTF-8 varies. I believe digits (0-9) are all 1 byte/char.
В списке pgsql-general по дате отправления