Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id AAEB32E466E for ; Fri, 11 Jan 2008 18:44:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 14756-02 for ; Fri, 11 Jan 2008 18:44:01 -0400 (AST) Received: from smtp8-g19.free.fr (smtp8-g19.free.fr [212.27.42.65]) by postgresql.org (Postfix) with ESMTP id 2C2542E34AD for ; Fri, 11 Jan 2008 18:44:00 -0400 (AST) Received: from smtp8-g19.free.fr (localhost [127.0.0.1]) by smtp8-g19.free.fr (Postfix) with ESMTP id EE6AF17F558; Fri, 11 Jan 2008 23:43:58 +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 BF65317F541; Fri, 11 Jan 2008 23:43:58 +0100 (CET) Date: Fri, 11 Jan 2008 23:43:58 +0100 (CET) From: Pomarede Nicolas X-X-Sender: npomarede@localhost To: Andrew Sullivan cc: pgsql-performance@postgresql.org Subject: Re: Best way to index IP data? In-Reply-To: <20080111222403.GA7527@crankycanuck.ca> Message-ID: References: <200801101614.54729.kevin@kevinkempterllc.com> <36e682920801101541o7626bbddj428617144240c554@mail.gmail.com> <13179.1200064791@sss.pgh.pa.us> <20080111162747.GT5294@mathom.us> <24044.1200082058@sss.pgh.pa.us> <20080111212703.GU5294@mathom.us> <20080111213710.GD8260@alvh.no-ip.org> <20080111220235.GX5294@mathom.us> <20080111222403.GA7527@crankycanuck.ca> 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/83 X-Sequence-Number: 28322 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