Re: appropriate column for storing ipv4 address

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general general <pgsql-general(at)postgresql(dot)org>
Subject: Re: appropriate column for storing ipv4 address
Date: 2017-03-01 18:03:54
Message-ID: ABDAA428-A7AE-4E99-ABD5-16B1407B8DA4@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> On Mar 1, 2017, at 8:39 AM, jonathan vanasco <postgres(at)2xlp(dot)com> wrote:
>
>
> I have to store/search some IP data in Postgres 9.6 and am second-guessing my storage options.
>
>
> The types of searching I'm doing:

[...]

>
> 2. on tracked_ip_block, i search/join against the tracked_ip_address to show known ips in a block, or a known block for an ip.
>
> i used cidr instead of inet for the ip_address because it saved me a cast on joins and appears to work the same. was that the right move? is there a better option?

If you're looking to do fast searches for "is this IP address in any of these CIDR blocks" you might want to look at https://github.com/RhodiumToad/ip4r as a possible alternative.

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message jonathan vanasco 2017-03-01 18:19:09 Re: disk writes within a transaction
Previous Message Paul Jungwirth 2017-03-01 16:57:51 Re: appropriate column for storing ipv4 address