Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id D96692E3735 for ; Fri, 11 Jan 2008 11:55:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 19765-02 for ; Fri, 11 Jan 2008 11:55:23 -0400 (AST) Received: from smtp8-g19.free.fr (smtp8-g19.free.fr [212.27.42.65]) by postgresql.org (Postfix) with ESMTP id BC6C02E3710 for ; Fri, 11 Jan 2008 11:55:32 -0400 (AST) Received: from smtp8-g19.free.fr (localhost [127.0.0.1]) by smtp8-g19.free.fr (Postfix) with ESMTP id 0A8FF17F557; Fri, 11 Jan 2008 16:55:31 +0100 (CET) Received: from pulsar.staff.proxad.net (pulsar.staff.proxad.net [213.228.1.109]) by smtp8-g19.free.fr (Postfix) with ESMTP id CF39917F519; Fri, 11 Jan 2008 16:55:30 +0100 (CET) Date: Fri, 11 Jan 2008 16:55:30 +0100 (CET) From: Pomarede Nicolas X-X-Sender: npomarede@localhost To: Tom Lane cc: pgsql-performance@postgresql.org Subject: Re: Best way to index IP data? In-Reply-To: <13179.1200064791@sss.pgh.pa.us> Message-ID: References: <200801101614.54729.kevin@kevinkempterllc.com> <36e682920801101541o7626bbddj428617144240c554@mail.gmail.com> <13179.1200064791@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/68 X-Sequence-Number: 28307 On Fri, 11 Jan 2008, Tom Lane wrote: > Pomarede Nicolas writes: >> As ip4r seems to work very well with postgresql, is there a possibility to >> see it merged in postgresql, to have a native 4 bytes IPv4 address date >> type ? > > Given that the world is going to IPv6 in a few years whether you like it > or not, that seems pretty darn short-sighted to me. > > What would make sense IMHO is to adapt the improved indexing support in > ip4r to work on the native inet/cidr types. > I understand your point on IPv6, but still being able to store IPv4 addresses with as little overhead as possible is important. IPv6 will certainly grow in the year to come, but if you consider the case of a very large private lan, with ip in the form 10.x.y.z, the fact that the outside world is now ipv6 doesn't necessarily imply you will rename all your internal equipments to be ipv6 if you don't need more addresses (you can do the translation when packets cross the ipv6/ipv4 gateway in your network). To be more concret, I'm working for a large french ISP, so far we have 2+ millions "boxes" (triple play adsl equipments) at our customers' home. All theses boxes have a private IPv4 address in 10.x.y.z as well as a public IPV4 address, and although we recently activated a public IPv6 addr on these boxes too (which certainly gives one of the biggest IPv6 network so far), we still need to store one ipv4 and one ipv6 addr for each box. So, my point was not to be short-sighted, we will go IPv6 for sure, it's just that there're a lot of applications where storing ipv4 addr could be needed (whether ipv6 is required for other applications or not), and in this regard, I think that being able to store ipv4 addr with 4 bytes instead of 8 could be appreciated. Or perhaps another solution would be to have built-in inet_aton / inet_ntoa functions in postgres, to store the result using an integer (unsigned) ? Nicolas