Re: [GENERAL] appropriate column for storing ipv4 address - Mailing list pgsql-general

From Paul Jungwirth
Subject Re: [GENERAL] appropriate column for storing ipv4 address
Date
Msg-id 0af9b9a3-2b7d-65df-a25e-a310f5e4aa27@illuminatedcomputing.com
Whole thread Raw
In response to [GENERAL] appropriate column for storing ipv4 address  (jonathan vanasco <postgres@2xlp.com>)
Responses Re: [GENERAL] appropriate column for storing ipv4 address  (Emre Hasegeli <emre@hasegeli.com>)
List pgsql-general
On 03/01/2017 08:39 AM, jonathan vanasco wrote:
>
> I have to store/search some IP data in Postgres 9.6 and am second-guessing my storage options.
>
> Would anyone mind giving this a quick look for me?
>
> Right now I have two tables, and am just using cidr for both:

Hi Jonathan,

CIDR seems like a better match to how people think about IPs, but
another option would be to use a custom range type on inet. I wrote a
blog post about that here, including how to use a GiST index to get fast
searches:

http://illuminatedcomputing.com/posts/2016/06/inet-range/

Maybe it will be useful for you! Or maybe there is already some built-in
way to treat cidr columns like ranges?

Paul


pgsql-general by date:

Previous
From: jonathan vanasco
Date:
Subject: [GENERAL] appropriate column for storing ipv4 address
Next
From: Steve Atkins
Date:
Subject: Re: [GENERAL] appropriate column for storing ipv4 address