查询缓存不起作用 [英] query cache doesn't work

查看:113
本文介绍了查询缓存不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已打开query_cache,并为其分配了内存:

I have turned on query_cache, and allocated memory for it:

| query_cache_limit            | 1048576    |
| query_cache_min_res_unit     | 4096       |
| query_cache_size             | 16777216   |
| query_cache_type             | ON         |
| query_cache_wlock_invalidate | OFF        |

但是查询不会被缓存:

| Qcache_free_blocks             | 1        |
| Qcache_free_memory             | 16768400 |
| Qcache_hits                    | 0        |
| Qcache_inserts                 | 0        |
| Qcache_lowmem_prunes           | 0        |
| Qcache_not_cached              | 163      |
| Qcache_queries_in_cache        | 0        |
| Qcache_total_blocks            | 1        |

我使用Innodb作为存储引擎,没有事务.未缓存的示例查询:

I use Innodb as storage engine, without transactions. The sample query which is not cached:

select * from `feed-ts`.feeds where id < 10;

它仅返回一行.

有什么想法吗?

推荐答案

一个错误在MySQL中.

查询缓存根本不会用于对带有连字符名称(例如feed-ts)的数据库中的InnoDB表进行查询.

The query cache simply doesn't get used for queries on InnoDB tables that are in a database with a hyphenated name (like feed-ts).

"重命名"您的数据库似乎是目前唯一的解决方案.

"Renaming" your database seems to be the only solution for now.

这篇关于查询缓存不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆