From: | Alan McKay <alan(dot)mckay(at)gmail(dot)com> |
---|---|
To: | "David F(dot) Skoll" <dfs(at)roaringpenguin(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Efficiently searching for CIDRs containing an IP address |
Date: | 2009-06-01 01:14:50 |
Message-ID: | 844129e80905311814o4ab50ad8jb41172010ce612b4@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hmmm, I've never done this quite that way, but IPs - especially CIDRs
- are far easier to work with in binary format than in human-readable
format. At my old workplace about 5 years ago I wrote an IP
management system (PHP/MySQL) that stored the IP in binary and
human-readable formats, but all of the computations and comparisons
and other such stuff always took place with the binary values (binary
stored as a string of 0s and 1s as I recall).
So is this not simply easier to implement with a library of functions
to convert a string to binary and back? I recall in my implementation
I had only 4 or 5 functions including converting back-and-forth from
binary to human-readable, binary-AND, binary-OR and maybe one or two
others.
--
“Mother Nature doesn’t do bailouts.”
- Glenn Prickett
From | Date | Subject | |
---|---|---|---|
Next Message | David F. Skoll | 2009-06-01 10:14:05 | Re: Efficiently searching for CIDRs containing an IP address |
Previous Message | Tom Lane | 2009-05-31 16:38:45 | Re: PostgreSQL crashes |