-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
修改post表存储引擎提高全表行数统计的性能 #20
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题
PostMaaper#selectPostCount实现了对post全表的行数统计,因为新版本的Mysql中默认使用了InnoDB作为数据库引擎,在InnoDB中不会缓存表的元数据,因此执行这样的语句会造成比较大的时间开销,而MyISAM则缓存有表的元数据,统计行数可以在很短的时间内完成。如果没有其它必须使用InnoDB的原因,建议修改这两张表的存储引擎从而优化这类语句。
参考:https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html#function_count
解决方法
修改post的存储引擎为MyISAM
The text was updated successfully, but these errors were encountered: