简体   繁体   English

官方MySQL Docker容器不缓存查询吗?

[英]Official MySQL Docker container not caching queries?

I tested the official MySQL Docker container (mysql:latest https://hub.docker.com/_/mysql/ ) with an about 500-700MB database. 我测试了带有约500-700MB数据库的官方MySQL Docker容器(mysql:latest https://hub.docker.com/_/mysql/ )。

While in my natively installed MySQL this database with one specific query takes about 1.5 seconds the first time, the following times take max. 在我本机安装的MySQL中,带有一个特定查询的数据库第一次大约需要1.5秒,而接下来的时间最多。 100ms for the same query. 相同查询为100毫秒。 In my docker container this "query caching" doesn't seem to apply. 在我的Docker容器中,这种“查询缓存”似乎不适用。 The same query always takes the same amount of time. 相同的查询始终花费相同的时间。

How do I enable query caching or how to I look up these MySQL settings to apply them to my MySQL docker? 如何启用查询缓存,或者如何查找这些MySQL设置以将其应用于我的MySQL docker?

Additional information: The query in question is an address search WHERE includes postal code, street name, house number, city I already indexed these columns for the search to work faster which already halved the query execution time. 其他信息:有问题的查询地址搜索WHERE包括邮政编码,街道名称,门牌号码,城市我已经索引这些列的搜索速度更快,其已经减半查询执行时间的工作。

mysql disabled query caching https://dev.mysql.com/doc/refman/5.7/en/query-cache-configuration.html mysql禁用查询缓存https://dev.mysql.com/doc/refman/5.7/en/query-cache-configuration.html

The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0.

Latest would include this 最新的将包括此

https://www.percona.com/blog/2015/08/07/mysql-query-cache-worst-enemy-best-friend/ https://www.percona.com/blog/2015/08/07/mysql-query-cache-worst-enemy-best-friend/

I would recommend keeping it disabled if possible and have the application cache rather than the database 我建议尽可能将其禁用,并保留应用程序缓存而不是数据库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM