Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 7DF189FB31E for ; Mon, 29 Jan 2007 12:26:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 53795-08 for ; Mon, 29 Jan 2007 12:26:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mx01.bfk.de (mx01.bfk.de [193.227.124.2]) by postgresql.org (Postfix) with ESMTP id A4B249FA2BB for ; Mon, 29 Jan 2007 12:26:46 -0400 (AST) Received: from mx00.int.bfk.de ([10.119.110.2]) by mx01.bfk.de with esmtp id 1HBZLB-0001cx-5A; Mon, 29 Jan 2007 17:26:45 +0100 Received: from fweimer by bfk.de with local id 1HBZL8-00046Y-VF; Mon, 29 Jan 2007 17:26:42 +0100 To: Pomarede Nicolas Cc: pgsql-performance@postgresql.org Subject: Re: int4 vs varchar to store ip addr References: From: Florian Weimer Date: Mon, 29 Jan 2007 17:26:42 +0100 In-Reply-To: (Pomarede Nicolas's message of "Mon, 29 Jan 2007 17:22:22 +0100 (CET)") Message-ID: <82ac014x4t.fsf@mid.bfk.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/407 X-Sequence-Number: 23008 * Pomarede Nicolas: > I could use PG internal inet/cidr type to store the ip addrs, which > would take 12 bytes per IP, thus gaining a few bytes per row. I thought it's down to 8 bytes in PostgreSQL 8.2, but I could be mistaken. > Apart from gaining some bytes, would the btree index scan be faster > with this data type compared to plain varchar ? It will be faster because less I/O is involved. For purposes like yours, there is a special ip4 type in a contributed package which brings down the byte count to 4. I'm not sure if it's been ported to PostgreSQL 8.2 yet. --=20 Florian Weimer BFK edv-consulting GmbH http://www.bfk.de/ Kriegsstra=DFe 100 tel: +49-721-96201-1 D-76133 Karlsruhe fax: +49-721-96201-99