This is a problem a friend of mine has.
He has a table keyword with only 9000 records. The MySQL server has a public ip and when I execute SELECT id, word FROM keyword from my machine(I access the MySQL server over the Internet), the query is very fast(200 milliseconds). No matter how many times I run it, it is very fast as it should be. So far so good.
Now he runs the same query from his machine in his intranet and accesses the MySQL server again with the public ip. The query sometimes takes as much as 40 seconds and it is logged as a slow query in the MySQL server log. He tried also from another machine in his intranet and again it takes sometimes as much as 40 seconds.
How is this possible? If it is a network problem only in his intranet, then why MySQL logs it as a slow query? AFAIK, MySQL query time in the slow query log doesn’t include network transfer?
How to troubleshoot this problem? I am really frustrated.
Greetings,
Petar
Use this to see the difference:
and maybe add:
More information in the manual:
http://dev.mysql.com/doc/refman/5.0/en/show-profile.html