- - Code, Content, and Presentation
- -- Databases
- ---- 100% Cpu
phranque - 10:12 am on Mar 12, 2013 (gmt 0)
for starters i would try creating an index for the 'ip' and 'counter' columns.
then you might consider using the alphanumeric character class within a bracket expression in your second SELECT statement.
AND ip REGEXP '[[:alnum:]]' ...
while i haven't tested this i would assume that it's faster than "... AND ip REGEXP '[A-Za-z0-9]' ..." so it's probably worth a try.
Thread source: http://www.webmasterworld.com/databases_sql_mysql/4553387.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com