I'm storing IPv4 addresses in a "int unsigned" column type with inet_aton. [Am I doing this right? And is using "unsigned" necessary?] This particular column is indexed as well. Since there will be millions of rows and multiple rows containing the same IP throughout the entire table what will be the fastest way to search for these rows?
..or am I going about this the wrong way?
Am I doing this right? And is using "unsigned" necessary?
Yes. Without unsigned
higher ip addresses will not be stored properly and using int
(instead of varchar
) stores it most efficiently.
what will be the fastest way to search for these rows?
As far as search optimization, that depends on what all you're searching for (additional tables, etc...). In general, indexing an unsigned int column gives you fast performance.