CodeIgniter Forums

Full Version: Can I get MySQL to perform queries without any kind of caching?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]warpspasm[/eluser]
I have a JSON controller that makes a number of MySQL queries. One of the queries seems to have gotten slower but I don't know which one it is.

The problem is that sometimes the query is slow and then other times it is faster (especially if I run the same request immediately afterwards.)

This leads me to believe that MySQL is doing some kind of caching?

So, my question is: How can I get CodeIgniter / MySQL to run queries without any kind of caching so that I can start tracing which query is causing the problems?

Thanks for any ideas on how to get started on this!

Chris

El Forum

[eluser]boltsabre[/eluser]
Google helps for these kinds of things, literally 100's of valid answers. Here is what I got in position 1:

http://stackoverflow.com/questions/18189...d-of-query

From the search query "how to stop mysql from caching results". Scroll down the page, I use the NOW() option.

Good luck bug hunting your queries, hope you find the culprit!

One other thing that springs to mind, try rebuilding you indexes, that should give you some instant improvement regarding speed.

El Forum

[eluser]CroNiX[/eluser]
The profiler will show you all of the queries being run during an execution cycle, along with their memory consumption and query time. Good for troubleshooting stuff like this.

El Forum

[eluser]CroNiX[/eluser]
Also make sure you turn off caching in your ajax call (if you're using jQuery there is an $.ajax setting for that) and check to see if you have CI's Query Caching enabled. Those could also affect that.