pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Artz <mlartz@gmail.com>
To: Pomarede Nicolas <npomarede@corp.free.fr>
Cc: Florian Weimer <fweimer@bfk.de>
Cc: pgsql-performance@postgresql.org
Subject: Re: int4 vs varchar to store ip addr
Date: Thu, 1 Feb 2007 14:30:42 -0500
Message-ID: <e9c163070702011130h184ed360p2956eba6bc49e2f0@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0701301149140.32052@localhost>
References: <Pine.LNX.4.64.0701291644110.15162@localhost>
	<82ac014x4t.fsf@mid.bfk.de>
	<Pine.LNX.4.64.0701301149140.32052@localhost>

On 1/30/07, Pomarede Nicolas <npomarede@corp.free.fr> wrote:
> On Mon, 29 Jan 2007, Florian Weimer wrote:
>
> > * 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.
>
> Yes thanks for this reference, ip4r package seems to be a nice addition to
> postgres for what I'd like to do. Does someone here have some real life
> experience with it (regarding performance and stability) ?

I'm using IP4 and have not had a problem with it in 8.2 (or 8.1) in
terms of stability.  As I designed my DB using it, I don't really have
any comparisons to inet and/or varchar.  One of the most useful things
for me is the ability to create a GIST index to support determination
of range inclusion (i.e. 192.168.23.1 is in the 192.168/16 network
range), although it doesn't sound like this would be useful to you.

-Mike



view thread (5+ messages)

Message-ID: <e9c163070702011130h184ed360p2956eba6bc49e2f0@mail.gmail.com>
Permalink:  ../e9c163070702011130h184ed360p2956eba6bc49e2f0@mail.gmail.com/
Also on:    postgresql.org/message-id/e9c163070702011130h184ed360p2956eba6bc49e2f0@mail.gmail.com

 · 

reply

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: mlartz@gmail.com, npomarede@corp.free.fr, fweimer@bfk.de
  Subject: Re: int4 vs varchar to store ip addr
  In-Reply-To: <e9c163070702011130h184ed360p2956eba6bc49e2f0@mail.gmail.com>

* 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