Skip to content
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

Open
wtune opened this issue Mar 18, 2020 · 0 comments
Open

修改post表存储引擎提高全表行数统计的性能 #20

wtune opened this issue Mar 18, 2020 · 0 comments

Comments

@wtune
Copy link
Contributor

wtune commented Mar 18, 2020

问题

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

@wtune wtune changed the title 修改数据库表引擎提高全表行数统计的性能 修改post表存储引擎提高全表行数统计的性能 Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant