4 ms·
Yes, storing is different from displaying though. In MySQL for example, that's what INET_ATON() and INET_NTOA() are for, to convert between binary and display.
by crazygringo 4y ago
Yes, storing is different from displaying though.
In MySQL for example, that's what INET_ATON() and INET_NTOA() are for, to convert between binary and display.
Analogous to storing timestamps but displaying as datetimes in a timezone.
- lucb1e 4y agoI'd still much rather store something that can be indexed in a btree than something where you have to always call a function on and do full table scans. Of course, before displaying to the user you'd use long2ip again (or the database equivalent you mentioned; I usually avoid doing unnecessary computations on the database and, instead, let the application handle display logic).
- crazygringo 4y agoSorry if I wasn't clear, I was agreeing with you! Yes precisely for indexing (plus just a fixed column size that wastes no space).
- wjholden 4y agoThis is why I love this site. I've been doing networking for many years and I'm not a total novice in databases, but I had no idea MySQL had these functions.
- brobinson 4y agoPrepare to be even more amazed: https://www.postgresql.org/docs/current/datatype-net-types.html https://www.postgresql.org/docs/current/datatype-net-types.h... https://www.postgresql.org/docs/current/functions-net.html https://www.postgresql.org/docs/current/functions-net.html