Re: decimal(5) vs int8. Which more efficient.

Поиск
Список
Период
Сортировка
От Francisco Reyes
Тема Re: decimal(5) vs int8. Which more efficient.
Дата
Msg-id 20020309105218.I30534-100000@zoraida.natserv.net
обсуждение исходный текст
Ответ на Re: decimal(5) vs int8. Which more efficient.  (Thomas Lockhart <lockhart@fourpalms.org>)
Список pgsql-general
On Fri, 8 Mar 2002, Thomas Lockhart wrote:

> > What would be more efficient for storing a value that is 5 Bytes long?
> > decimal(5) or int8?
> > Does decimal(5) actually uses up only 5 bytes? Does that cause any
> > problems?
>
> int8 wins on all counts afaik. decimal() and numeric() store things as
> quasi-BCD and is less dense than a true binary storage type.

I decided to find a way to store the number, a key, in 4 bytes. Not what I
wanted, but... given the "issues" I read about int8 such as having
problems been recognized by the optimizer when doing searches.

The example on the docs is that something like:
select * from table where <int8> = ###

would not use the index. One would have to do:
select * from table where <int8> = '###'

Which is a pain.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Fsync on/off For Various Filesystems/Platforms (Ending Note)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: RULE with conditional behaviour?