On Sun, 21 Mar 1999 11:16:47 +0200, kalle volkov wrote:
>SELECT SUBSTRING_INDEX(ip,'.',-1) AS temp, count(ip) AS howmany FROM
>MyDatabase GROUP BY temp ORDER BY howmany DESC LIMIT 10;
1. Rearrange HOST=d1.d2.d3 => TSOH=d3.d2.d1.
2. Make index (TSOH)
3. retrieve by LIKE 'ee.%'
Alternatively, Parse d1.d2.d3...dn to retrieve dn. Store dn separately
and index it.
SELECT ... GROUP BY dn ORDER BY hownany ...
Depends on what you want to do with the data, but either solution
should return your results more of less instantaneously.
-Sincerely, Fred
(Frederik Lindberg, Infectious Diseases, WashU, St. Louis, MO, USA)