List:General Discussion« Previous MessageNext Message »
From:Ryan Fox Date:December 19 2001 2:25am
Subject:Re: Mysql query it too slow in big table
View as plain text  
> ###query the last time where ip='172.017.011.253'
> mysql> select max(THE_TIME) from COLL_DATA where
IP_ADDR='172.017.011.253';
> +---------------------+
> | max(THE_TIME) |
> +---------------------+
> | 2001-11-26 14:35:18 |
> +---------------------+
> 1 row in set (6.77 sec)
> ~~~~~~~~It's too slowly

Try storing the IP address as a numeric type, possibly decimal(10), and
using the functions INET_NTOA and INET_ATON to convert from the address back
and forth between dotted hexadecimal and decimal.  This will help because
instead of searching for MySQL having to search a varchar(50) field, it can
search a numeric field, which of course is faster.

Ryan

Thread
Mysql query it too slow in big tablexutian19 Dec
  • Re: Mysql query it too slow in big tableRyan Fox19 Dec
  • Re: Mysql query it too slow in big tableDan Nelson19 Dec
  • Re: Mysql query it too slow in big tablexutian19 Dec