Re: datatype advice numeric vs. varchar

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: datatype advice numeric vs. varchar
Дата
Msg-id 20070118061921.GB29963@svana.org
обсуждение исходный текст
Ответ на datatype advice numeric vs. varchar  (Gene <genekhart@gmail.com>)
Ответы Re: datatype advice numeric vs. varchar  (Gene <genekhart@gmail.com>)
Список pgsql-general
On Thu, Jan 18, 2007 at 01:15:02AM -0500, Gene wrote:
> I'm working on a voicemail application which involves storing phone
> numbers and other types that have long sequences of digits [0-9]. I
> need to be able to do pattern matching using LIKE and map the fields
> back to java String objects. I was thinking maybe it would be more
> efficient to use the numeric(x,0) type instead of a varchar since it
> could use less space on disk.

Your calculations are reasonable, but if you do it as numeric you're
going to be fighting the system the whole way. Numerics are treated as
numbers and things like LIKE don't work on them. When you select them,
java is likely to convert them to numbers there too.

Is this not a case of premature optimisation?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: FATAL: invalid frontend message type 47 server closed the connection unexpectedly
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: datatype advice numeric vs. varchar