List:General Discussion« Previous MessageNext Message »
From:Roger Baklund Date:May 11 2005 10:50am
Subject:Re: Solution to slow queries
View as plain text  
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

Thread
Solution to slow queriesPaul Halliday10 May
  • Re: Solution to slow queriesFrank Bax10 May
    • Re: Solution to slow queriesJohn McCaskey10 May
  • Re: Solution to slow queriesJames Nobis10 May
  • Re: Solution to slow queriesmfatene10 May
  • Re: Solution to slow queriesRoger Baklund10 May
    • Re: Solution to slow queriesPaul Halliday10 May
      • Re: Solution to slow queriesRoger Baklund11 May
RE: Solution to slow queriesTheRefUmp10 May
  • Re: Solution to slow queriesEric Jensen10 May