简体   繁体   中英

Is it Mysql take long time to respond when i execute a long query?

When I execute some more MySQL join queries, one of the queries takes a long time to respond and enter to the processlist. Then I execute

SHOW PROCESSLIST

query. It shows the state as 'Sending data' and a very large number(757497478) in Rows_examined for my query. How can we solve this issue?

Sending large chunks of information was and will always be time-consuming. You can improve your hardware to make sure it can handle large data processing/sending faster or you could break down your query into chunks. If, instead of selecting all the information at once you could select the number of rows to be returned first, break that down into partitions using the limit clause and call each partitions. This way your application would not have to wait for the whole answer to be sent, but rather load it as smaller batches and start processing the first batch while you are waiting for the second. There is no solution for the issue, because beyond a certain limit you encounter practical infinity, but there are ways to better manage this problem. Also, you could review your query and see whether you need all the tables in your join or some of those tables are unnecessary there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM