MySQL query slows down when another query is concurently sent

放肆的年华 提交于 2019-12-25 07:04:24

问题


I am using an InnoDB table that currently has 16m of records. When I run the following query by using MySQL Workbench, it returns in about 14 seconds:

SELECT countryCode AS label, SUM(count) AS value 
FROM AnalyticsPieCharts 
GROUP BY label 
ORDER BY value DESC;   

When I run the same query from a different computer, while the first one is running, both return in about 23-24 seconds.

I haven't created any indexes (except of the primary key) or put transaction rules. I am using Amazon RDS.

Do you have any clue on what could be the problem?


回答1:


I managed to solve it by myself. I found a pattern in the data, that allowed me to split the data into unique chunks and count the chunks later, when needed. This way I reduced the size of the database by 300 times. Now the queries return in 1 second and the total amount of the non-chunked table (the big table) is now 120mln records.



来源:https://stackoverflow.com/questions/32308980/mysql-query-slows-down-when-another-query-is-concurently-sent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!