On Mar 28, 2010, at 8:15 PM, Stewart Smith wrote: > On Sat, 27 Mar 2010 10:56:01 -0700, Brian Aker <[email protected]> wrote: >> On Mar 27, 2010, at 9:34 AM, Rob Wultsch wrote: >> >>> Is it safe to assume that an ipv6 col could store correctly an v4 >>> address? >> >> Yes, the problem is storage size, storing ipv4 in ipv6 wastes a bit of >> space. Personally? I would start with ipv6 and then do an optimized >> ipv4. > > I wonder if we're talking about another 3 byte int problem here. In some > number of years (as it has been for the past some number of years) IPv6 > will be everywhere. I wonder if allowing people to make big databases > with columns that *only* take IPv4 will hurt them in a couple of years. > > The big question being: can we have a full online alter table switching > from IPv4 to IPv6 columns *before* IPv6 is widely enough deployed to > make this a problem? > > So I think I'm in favour of forcing everyone to use the IPv6 > representation for IPv4 addresses.
I would be as long as it was packed and there were easy ways to represent IPv4 addresses. Say using the INET_* functions and perhaps renaming them to INET4. I see generally no point in consuming 16 bytes for a 4 byte address. It solves the conveniency problem but makes the question of space much more of an issue. People storing IPv4 addresses now would have to quadruple the space required for those and IPv4 is going to be around for a long time to come I'd bet. Even the most liberal estimates of when we are all going to be on IPv6 are years out. That also does not count for current private networks, among other things. I'm not sure if it would be worth the space savings, but since IPv4 is a subset of IPv6, those could be stored using 4 or 5 bytes and otherwise more are used. Using some sort of short-hand or compression might be a good idea here though. Yes, one can use InnoDB compression, but I like the idea of having a solution that is engine agnostic but also somewhat efficient. One thing about an IPv4 type is that it's likely to be simple. Or at least could be simple. Having it understand CIDR would be hot but really if it can efficiently store an IP address in 4-bytes without having the user do weird things to correct the signed but I'm happy. Basically that distills down to a 4-byte integer of some sort with some constraints handling and pretty displaying. An IPv6 type could be the same thing, but with IPv6 addresses, however, the complexity of the IPv6 type is such that I'm not sure it would be as simple as a 16-byte binary type with some prettification. $0.02 Tim S. _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

