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.

Recommended Answers

All 2 Replies

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, learning, and sharing knowledge.