Re: Best way to index IP data?

From: Pomarede Nicolas <npomarede(at)corp(dot)free(dot)fr>
To: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Best way to index IP data?
Date: 2008-01-11 22:43:58
Message-ID: Pine.LNX.4.64.0801112336500.30027@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, 11 Jan 2008, Andrew Sullivan wrote:

> On Fri, Jan 11, 2008 at 05:02:36PM -0500, Michael Stone wrote:
>
>> networks), but there's a conspicuous lack of a type for (hosts). I
>> suppose if you really are sure that you want to store hosts and not
>> networks
>
> Well, part of the trouble is that in the CIDR world, an IP without a netmask
> can be dangerously ambiguous. I can see why the design is as it is for that
> reason. (But I understand the problem.)
>
> A
>

Yes, in fact it all depends on the meaning you give to an IP.

If you want to store subnets, then you need an IP and a netmask, but if
you just want to store the IP of a particular equipment (that is, the IP
that will be refered to in the TCP/IP header), then there's no ambiguity,
you just need 4 bytes to describe this IP.

And it's true for IPv6 too, storing an IP that refer to an end point and
not a subnet is requiring twice as much data as needed, because the
netmask would always be ff:ff:ff:..:ff

So, for people dealing with large database of IPs, it would be nice to be
able to save 50% of the corresponding disk/cache/ram space for these IPs.

Nicolas

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Andrew Sullivan 2008-01-11 23:00:55 Re: Best way to index IP data?
Previous Message Steve Atkins 2008-01-11 22:38:27 Re: Best way to index IP data?