0

I'm migration my .NET/MSSQL to RoR/MySQL/EC2/Ubuntu platform. After I transferred all my existing data into MySQL, I found the MySQL querying speed is incredibily slow, even for a super-basic query , like querying a select count(*) from countries, it's just a country table, only contains around 200 records, but it takes 0.124ms for the query. It's obviously not normal.

I'm a newbie to MySQL, can anyone tell me what would be the possible problem? Or any initial optimization button I should turn on after installing MySQL?

4

1 回答 1

0

count(*)操作无法真正优化,因为它必须进行全表扫描(O(n))或读取缓存表计数(O(1)),具体取决于您使用的数据库引擎。无论哪种方式,您的查询都不应该那么慢。您可能想要联系 AWS 支持。盒子可能被其他运行在上面的进程阻塞了。

于 2013-03-03T23:15:59.860 回答