Re: [PERFORM] Filter certain range of IP address. - Mailing list pgsql-performance

From Moreno Andreo
Subject Re: [PERFORM] Filter certain range of IP address.
Date
Msg-id f119e6db-463d-9821-fad1-ed5e9a7b25cb@evolu-s.it
Whole thread Raw
In response to Re: [PERFORM] Filter certain range of IP address.  (Rick Otten <rottenwindfish@gmail.com>)
List pgsql-performance
Il 07/04/2017 17:56, Rick Otten ha scritto:


On Fri, Apr 7, 2017 at 11:29 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Fri, Apr 7, 2017 at 8:18 AM, Dinesh Chandra 12108 <Dinesh.Chandra@cyient.com> wrote:
Dear Vinny,

Thanks for your valuable replay.

but I need a select query, which select only that record which starts from IP "172.23.110" only from below table.

xxx     172.23.110.175
yyy     172.23.110.178
zzz     172.23.110.177
aaa     172.23.110.176
bbb     172.23.111.180
ccc     172.23.115.26

​SELECT ... WHERE substring(ip_addr::text, 1, 10) = '172.23.110'

or
   select ... where ip_addr << '172.23.110/32';
/32 is for one address only (fourth byte, which we want to exclude), so we need to use /24 (as for CIDR notation), that would be equal to a 255.255.255.0 subnet mask.

My 2 cents
Moreno


pgsql-performance by date:

Previous
From: Dinesh Chandra 12108
Date:
Subject: Re: [PERFORM] Filter certain range of IP address.
Next
From: vinny
Date:
Subject: Re: [PERFORM] Filter certain range of IP address.