Re: appropriate column for storing ipv4 address

From: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: appropriate column for storing ipv4 address
Date: 2017-03-01 16:57:51
Message-ID: 0af9b9a3-2b7d-65df-a25e-a310f5e4aa27@illuminatedcomputing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2017-03-01 18:03:54 Re: appropriate column for storing ipv4 address
Previous Message jonathan vanasco 2017-03-01 16:39:43 appropriate column for storing ipv4 address