Re: Best way to index IP data? - Mailing list pgsql-performance

From Pomarede Nicolas
Subject Re: Best way to index IP data?
Date
Msg-id Pine.LNX.4.64.0801112336500.30027@localhost
Whole thread Raw
In response to Re: Best way to index IP data?  (Andrew Sullivan <ajs@crankycanuck.ca>)
Responses Re: Best way to index IP data?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-performance by date:

Previous
From: Steve Atkins
Date:
Subject: Re: Best way to index IP data?
Next
From: Andrew Sullivan
Date:
Subject: Re: Best way to index IP data?