We have two similar spec HDD CentOS 7 servers for two different clients in different countries, both clients have the same database and same indexes.
- Client A: The server is only running MySQL 8 and it's extremely fast. Query X takes 11 seconds to finish. The database of client A has more records than client B.
- Client B: The server is running LAMP + MySQL 5.7, RAM, and CPU is normal, query X is talking more than two hours. Any query that takes X time on any other server, takes 10x time on client B server.
The MySQL storage for client B is located on a NAS, which has a 1GB interface with the server and 5MB/s IO speed. Only read/write are done on NAS. The reason is that the server has a small HDD, 250GB. Could that be the reason why it's so slow?
Please note that if the query does not have joins, it’s fast but if it has joins it’s not. Could it be that NAS is trying to cache something?