Dear experts
I am running one mysql query which contains selection from multiple tables.The problem is sometimes the query runs very slow, but sometimes it is ok.Acctually when i run it first time it is very very slow, and from the next time it becomes fast.I wonder if it is something related to cache.

Please suggest what can i do so it runs fast from the beginning.

the first time you run it, the database if preparing execution plan. afterwards, when it sees the same query again, it will retrieve execution plan from a cache.

mysql also does query caching too, so it is possible the result you got are cached.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.