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

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!


El Forum

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

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

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

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.