Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 4A7B82E4803 for ; Fri, 11 Jan 2008 17:37:21 -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 24604-05 for ; Fri, 11 Jan 2008 17:37:12 -0400 (AST) Received: from lists.commandprompt.com (host-159.commandprompt.net [207.173.203.159]) by postgresql.org (Postfix) with ESMTP id 534002E433C for ; Fri, 11 Jan 2008 17:37:16 -0400 (AST) Received: from perhan.alvh.no-ip.org (200-126-101-79.bk7-dsl.surnet.cl [200.126.101.79]) (authenticated bits=0) by lists.commandprompt.com (8.13.8/8.13.8) with ESMTP id m0BLbJBS020336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 11 Jan 2008 13:37:22 -0800 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 54D3947BCE; Fri, 11 Jan 2008 18:37:10 -0300 (CLST) Date: Fri, 11 Jan 2008 18:37:10 -0300 From: Alvaro Herrera To: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Best way to index IP data? Message-ID: <20080111213710.GD8260@alvh.no-ip.org> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080111212703.GU5294@mathom.us> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (lists.commandprompt.com [207.173.203.159]); Fri, 11 Jan 2008 13:37:22 -0800 (PST) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/78 X-Sequence-Number: 28317 Michael Stone wrote: > On Fri, Jan 11, 2008 at 03:07:38PM -0500, Tom Lane wrote: >> Michael Stone writes: >>> Well, a native IPv6 type would also be nice; inet is ridiculously bloated >>> for both IPv4 *and* IPv6. >> >> Nonsense. 3 bytes overhead on a 16-byte address is not "ridiculously >> bloated", especially if you want a netmask with it. > > Big if, no? There's a very large set of users that *don't* want/need a > netmask, which is why the topic keeps coming back. (Also, according to the > docs, inet requires 24 bytes, which is 50% more than needed; is that not > correct?) So what this means is that our type oughta be optimized. How about having a separate bit to indicate whether there is a netmask or not, and chop the storage earlier. (I dunno if this already done) Also, with packed varlenas the overhead is reduced AFAIK. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support