MySQL: is a complex query slower on a remote client than on a local client?
I'm wondering if a complex query (multiple LEFT JOIN's, some sub-SELECT's, and some GROUP BY's) is (much) slower when it is executed in a remote client than in a local client.
I always thought that a query was entirely executed on the server, and that only the sending of the results is slower on a WAN than on a LAN.
But some queries that are exectued almost instantly locally seem to last forever in a remote client. I'm using Navicat and I access the server remote over a normal internet connection (20 mbit down, 1 mbit up).
Is there maybe still some interaction going on between client and server, while the query executes ? Maybe some cachi开发者_开发知识库ng that is much faster locally than remote ?! (thought the caching happened serverside too...)
UPDATE: just did a very big test on a table with 500.000 records with several subquery's and groups (query took 700 seconds), using a SELECT COUNT around the complex query , and with SQL_NO_CACHE and it took exactly the same time remote as locally.... guess it was just the sending of data that was so slow remote then...
No. Only the amount of data transferred and the number of requests would be a factor.
There may be some meta communication that Navicat is using - perhaps running a bunch of small queries.
精彩评论