admin管理员组文章数量:1290293
Now the MySQL default query cache is disabled, as I remember long time ago, the hit rate of MySQL is quite high when running WordPress.
So I am thinking if enable it now will improve performance, anyone tried?
Now the MySQL default query cache is disabled, as I remember long time ago, the hit rate of MySQL is quite high when running WordPress.
So I am thinking if enable it now will improve performance, anyone tried?
Share Improve this question asked Oct 2, 2019 at 11:14 YogaYoga 9192 gold badges20 silver badges39 bronze badges 2- You can do something like this. https://dev.mysql/doc/refman/5.5/en/query-cache-configuration.html – Krupal Panchal Commented Oct 8, 2019 at 8:50
- 2 @Howard could you elaborate on why you've placed a new bounty on this question? Does the provided answer fail to address your issue? – bosco Commented Jun 16, 2021 at 18:41
2 Answers
Reset to default 6 +25General speaking yes for read-only applications (until MySQL 5.7, it's deprecated since version 8.0), it enables equal SELECT
s to return data extremely fast if identical calls are already stored in cache. You should consider that:
- Only exact same clauses can benefit from the cache engine (no spaces, no comments, no actual differences in
WHERE
expressions); - If you are updating often the table you will not benefit much of it, since the queries get invalidated, and the invalidation algorithms can also reduce performance, in some cases.
Excellent alternatives are:
- External caching engines (i.e. Memecached or Redis, my favorite, https://redislabs/wp-content/uploads/2016/03/15-Reasons-Caching-is-best-with-Redis-RedisLabs-1.pdf)
- ProxySQL (since MySQL 8.0) on which I have no experience. Read more https://mysqlserverteam/mysql-8-0-retiring-support-for-the-query-cache/
I think also if you combine those with a good web server like NGINX or Apache2 and an HTTP accelerator like Varnish you can fly.
As I know, these are also the best current practices but I might have ignored something, please share it in case.
MySQL's query cache was never much good and has been retired since version 8.0 So, if you're looking for optimizing database performance with WordPress, that's not the way to go. WP does have a tendency to bloat the database, however. There are several things you can do to prevent this.
- Limit revisions of your posts to 2 by including
define( ‘WP_POST_REVISIONS’, 2 );
inwp-config.php
. Or stop revisions alltogether withdefine( ‘WP_POST_REVISIONS’, false );
In phpMyAdmin you can delete existing revisions withDELETE FROM wp_posts WHERE post_type = "revision";
. - Database cleanup. When you disable a plugin, its data will usually be left in the database, so when you enable it again, you can pick it up where you left it. This can amount to a lot of data, though. All sorts of other orphan data may slow down MySQL as well. There are plenty of plugins that will help you clean up this stuff.
- Use the Query Monitor plugin to identify slow queries. A lousy script in your theme might be the culprit of a slow database and caching won't help with that.
本文标签: Is it useful to turn on MySQL query cache for performance
版权声明:本文标题:Is it useful to turn on MySQL query cache for performance 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741496273a2381848.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论