1
我想知道是否有人能指引我朝着正确的方向发展。我在Snow Leopard OSX机器上建立了一个本地的Mysql 5.1沙箱,我安装了Macports Mysql 5.1,并且所有外观都正常运行。它需要查询,数据库正在工作等等。唯一奇怪的是,查询缓存不起作用。我已经在linux中运行了它,并且在5.0 xammp安装中得到了它的工作,但我为什么不在这个设置中工作而沮丧。Mac上的Mysql 5.1:查询缓存不能正常工作
一些细节......
% cat /etc/my.cnf | grep -i query_cache query_cache_limit = 1M query_cache_size = 32M query_cache_type = 1 mysql> show variables like '%query_cache%'; +------------------------------+----------+ | Variable_name | Value | +------------------------------+----------+ | have_query_cache | YES | | query_cache_limit | 1048576 | | query_cache_min_res_unit | 4096 | | query_cache_size | 33554432 | | query_cache_type | ON | | query_cache_wlock_invalidate | OFF | +------------------------------+----------+ 6 rows in set (0.00 sec) mysql> show status like '%Qcache%'; +-------------------------+----------+ | Variable_name | Value | +-------------------------+----------+ | Qcache_free_blocks | 1 | | Qcache_free_memory | 33536856 | | Qcache_hits | 0 | | Qcache_inserts | 0 | | Qcache_lowmem_prunes | 0 | | Qcache_not_cached | 433 | | Qcache_queries_in_cache | 0 | | Qcache_total_blocks | 1 | +-------------------------+----------+ 8 rows in set (0.01 sec)
它看起来对我来说,一切都设置正确,这些基本上我已经在5.0和4.1中使用相同的设置。大部分查询都是可缓存的,而且我并不特意排除缓存。我不知道它是Mac问题,MacPorts问题还是5.1问题,还是我的个人问题。任何人都可以看到我的设置有什么问题?
好的,一些额外的信息。这似乎与Innodb有关。 MyISAM查询似乎缓存很好。
我的Inno Setup的:
$ cat /etc/my.cnf | grep nno # Uncomment the following if you are using InnoDB tables innodb_file_per_table innodb_data_home_dir = /opt/local/var/db/mysql5 innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /opt/local/var/db/mysql5 innodb_buffer_pool_size = 256M innodb_additional_mem_pool_size = 12M innodb_log_file_size = 50M innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 2 innodb_lock_wait_timeout = 300 innodb_flush_method=O_DIRECT
你怎么知道它不工作?你可以发布你试图运行的查询吗? – Quassnoi 2010-03-02 21:45:31
这433个查询中的大多数(> 50%)应该已经被缓存。 我可以运行: “select * from student limit 10;”反复 ,它会增加Qcache_not_cached号码,但不会缓存查询。 – TrippyD 2010-03-02 21:46:52
此外,该查询返回的结果远低于1M – TrippyD 2010-03-02 21:48:11