macrozheng
Dec 3, 2025 · Databases
Why Storing IP Addresses as VARCHAR(15) Is Suboptimal – Use INT UNSIGNED Instead
Although many developers store IPv4 addresses in MySQL using VARCHAR(15), the optimal approach is to store them as a 32‑bit unsigned integer, which saves space, speeds up indexing, and can be easily converted with MySQL's inet_aton and inet_ntoa functions.
Data TypesINT UNSIGNEDIP address
0 likes · 5 min read
