I am writing php scripts for an application. There are several queries like select * from table where name = .... and so on.
I would like such that once any unique query has been executed, it should be cached and should display quickly next time the same query is called unless the mysql table which is being accessed is updated or its timestamp changes.
Is this possible or there are better caching/speed improvements available?
Check out The Query Cache [dev.mysql.com] and also consider Stored Procedures [dev.mysql.com]. (The query cache is the first answer to your question, but I thought you might be interested in stored procedures, too.)
Thanks a ton. Query Cache works perfect and is super fast. I am impressed!
My concern is that I have around millions of different queries and I have set query-cache-size = 64M, but when I issue the command SHOW STATUS LIKE '%qcache%'; [Its almost down to 49 mb [Qcache_free_memory ] after just 11812 queries. What happens when it goes down to 0 mb