Re: int4 vs varchar to store ip addr

Поиск
Список
Период
Сортировка
От Florian Weimer
Тема Re: int4 vs varchar to store ip addr
Дата
Msg-id 82ac014x4t.fsf@mid.bfk.de
обсуждение исходный текст
Ответ на int4 vs varchar to store ip addr  (Pomarede Nicolas <npomarede@corp.free.fr>)
Ответы Re: int4 vs varchar to store ip addr  (Pomarede Nicolas <npomarede@corp.free.fr>)
Список pgsql-performance
* Pomarede Nicolas:

> I could use PG internal inet/cidr type to store the ip addrs, which
> would take 12 bytes per IP, thus gaining a few bytes per row.

I thought it's down to 8 bytes in PostgreSQL 8.2, but I could be
mistaken.

> Apart from gaining some bytes, would the btree index scan be faster
> with this data type compared to plain varchar ?

It will be faster because less I/O is involved.

For purposes like yours, there is a special ip4 type in a contributed
package which brings down the byte count to 4.  I'm not sure if it's
been ported to PostgreSQL 8.2 yet.

--
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

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

Предыдущее
От: Pomarede Nicolas
Дата:
Сообщение: int4 vs varchar to store ip addr
Следующее
От: Cosimo Streppone
Дата:
Сообщение: Re: int4 vs varchar to store ip addr