From: Florian Weimer <fweimer@bfk.de>
To: Pomarede Nicolas <npomarede@corp.free.fr>
Cc: pgsql-performance@postgresql.org
Subject: Re: int4 vs varchar to store ip addr
Date: Mon, 29 Jan 2007 17:26:42 +0100
Message-ID: <82ac014x4t.fsf@mid.bfk.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0701291644110.15162@localhost>
References: <Pine.LNX.4.64.0701291644110.15162@localhost>
* 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: fweimer@bfk.de, npomarede@corp.free.fr
Subject: Re: int4 vs varchar to store ip addr
In-Reply-To: <82ac014x4t.fsf@mid.bfk.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox