pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ip address data type
4+ messages / 4 participants
[nested] [flat]

* ip address data type
@ 2006-04-24 22:45  Sriram Dandapani <sdandapani@counterpane.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Sriram Dandapani @ 2006-04-24 22:45 UTC (permalink / raw)
  To: pgsql-performance

Hi

 

I have queries that use like operators and regex patterns to determine
if an ip address is internal or external (this is against a table with
say 100 million distinct ip addresses).

 

Does the inet data type offer comparison/search performance benefits
over plain text for ip addresses..

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: ip address data type
@ 2006-04-24 22:48  Jim C. Nasby <jnasby@pervasive.com>
  parent: Sriram Dandapani <sdandapani@counterpane.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Jim C. Nasby @ 2006-04-24 22:48 UTC (permalink / raw)
  To: Sriram Dandapani <sdandapani@counterpane.com>; +Cc: pgsql-performance

On Mon, Apr 24, 2006 at 03:45:14PM -0700, Sriram Dandapani wrote:
> Hi
> 
> I have queries that use like operators and regex patterns to determine
> if an ip address is internal or external (this is against a table with
> say 100 million distinct ip addresses).
> 
> Does the inet data type offer comparison/search performance benefits
> over plain text for ip addresses..

Well, benchmark it and find out. :) But it'd be hard to be slower than
like or regex...
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: ip address data type
@ 2006-04-24 23:40  Steve Atkins <steve@blighty.com>
  parent: Sriram Dandapani <sdandapani@counterpane.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Steve Atkins @ 2006-04-24 23:40 UTC (permalink / raw)
  To: pgsql-performance


On Apr 24, 2006, at 3:45 PM, Sriram Dandapani wrote:

> Hi
>
>
>
> I have queries that use like operators and regex patterns to  
> determine if an ip address is internal or external (this is against  
> a table with say 100 million distinct ip addresses).
>
>
>
> Does the inet data type offer comparison/search performance  
> benefits over plain text for ip addresses..
It's probably better than text-based, but it's hard to be worse than  
regex and like.

Depending on your exact needs http://pgfoundry.org/projects/ip4r/ may be
interesting, and I've also found pretty good behavior by mapping an IP
address onto a 2^31 offset integer.

Cheers,
   Steve



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: ip address data type
@ 2006-04-25 19:22  Florian Weimer <fw@deneb.enyo.de>
  parent: Sriram Dandapani <sdandapani@counterpane.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Florian Weimer @ 2006-04-25 19:22 UTC (permalink / raw)
  To: Sriram Dandapani <sdandapani@counterpane.com>; +Cc: pgsql-performance

* Sriram Dandapani:

> Does the inet data type offer comparison/search performance benefits
> over plain text for ip addresses..

Queries like "host << '192.168.17.192/28'" use an available index on
the host column.  In theory, you could do this with LIKE and strings,
but this gets pretty messy and needs a lot of client-side logic.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-04-25 19:22 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-24 22:45 ip address data type Sriram Dandapani <sdandapani@counterpane.com>
2006-04-24 22:48 ` Jim C. Nasby <jnasby@pervasive.com>
2006-04-24 23:40 ` Steve Atkins <steve@blighty.com>
2006-04-25 19:22 ` Florian Weimer <fw@deneb.enyo.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox