Paul Halliday wrote:
>>> srcaddr VARCHAR(15),
>>> dstaddr VARCHAR(15),
>>
>>Are these ip-adresses? If they are, consider using UNSIGNED INT columns
>>and the INET_NTOA() and INET_ATON() funtions. It will save you a lot of
>>space, thus increase the amount of data your hw can handle.
>
>
> They are indeed ip addresses. This infomation is gathered and input
> into the db via a program called flow-export (export netflows). I
> intially had the column as UNSIGNED INT but it would only pick up the
> first octet, so I switched to VARCHAR.
This would happen if you did not use INET_ATON() to transform the IP to
a single integer. When you select the data later, you use INET_NTOA() to
transform the other way:
mysql> select inet_aton('127.0.0.1');
+------------------------+
| inet_aton('127.0.0.1') |
+------------------------+
| 2130706433 |
+------------------------+
1 row in set (0.00 sec)
mysql> select inet_ntoa(2130706433);
+-----------------------+
| inet_ntoa(2130706433) |
+-----------------------+
| 127.0.0.1 |
+-----------------------+
1 row in set (0.00 sec)
<URL: http://dev.mysql.com/doc/mysql/en/miscellaneous-functions.html >
--
Roger