MySQL的缓存 [英] MySQL Caching

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

问题描述

昨天晚上,我在MySQL数据库中增加了一个参数的存储过程。我访问它,搞砸参数,并决定再次删除了参数,进行测试。不过分钟后重新创建的过程没有参数,我的命令对象还在抱怨缺少的参数。难道这个MySQL,MySQL的/连接器,ADO,或企业库的错,我该怎么办呢?

Last night I added a parameter to a stored procedure in a mySQL database. I accessed it, messed up the parameter, and decided to remove the parameter again, for testing. Still minutes after re-creating the procedure without the parameter, my command object was still complaining about a missing parameter. Is this mySQL, MySQL/Connector, ADO, or Enterprise library's fault, and what can I do about it?

推荐答案

在默认情况下的MySQL缓存中存储过程的查询。看看查询缓存启用:

By default MySQL caches queries in your stored procedures. See if Query Cache is enabled:

SHOW VARIABLES LIKE 'query_cache%'

存储过程调用不是由MySQL的缓存,但如果 query_cache_type的是这将影响从过程中发出的查询缓存。可能导致MySQL的返回相同的结果几分钟。尝试清空缓存,或者更好,重置查询缓存删除所有查询,如果您的更新程序保持返回的previous结果集:

Stored procedure calls are not cached by MySQL, but if query_cache_type is ON this will affect caching of queries issued from within the procedure. Possibly causing MySQL to return the same results for a couple of minutes. Try flushing the cache, or better yet, reset the query cache to remove all queries if your updated procedure keeps returning the previous result set:

RESET QUERY CACHE 

这应该消除MySQL服务器的任何缓存。

That should eliminate any caching by MySQL server.

下一次出现这种情况,你可以用手通过不使用MySQL /连接器或企业库其他工具执行的程序。这将告诉你,如果旧的结果集是由MySQL或驱动程序和应用程序块在应用程序缓存。

Next time this happens you could execute the procedure by hand through another tool that does not use MySQL/Connector or Enterprise Library. That will tell you if the old result set is cached by either MySQL or the drivers and application blocks in your application.

修改请阅读下面的意见,由desertwebdesign。重新创建存储过程后,断开连接。连接池可以保持连接打开,所以它可能是最好杀从MySQL连接。大多数查询浏览器有一个标签,让你去杀死在MySQL连接,如果你在使用过程中/超权限登录。

please read the comments below, by desertwebdesign. After recreating the sproc, drop the connection. Connection pooling may keep the connection open, so it's probably best to kill the connection from MySQL. Most query browsers have a tab that allow you to kill connections in MySQL if you log in with process/super privileges.

SHOW FULL PROCESSLIST
KILL CONNECTION thread_id

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

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