Mysql query cache
There is another mysql related optimization options. It is called query caching. It means, that if you execute completely same queries two times, first one will get results from table, but second one will get results without actually searching the table, from cache of result of the first query.
To check if you have query cache enabled, execute this query:
SHOW VARIABLES LIKE '%query_cache%'
It will say have_query_cache | YES |, if it is already enabled.
To enable it, you must edit mysql configuration file, usually my.cnf. Set query-cache-type = 1 and query-cache-size = 20M.
That's it, just remember it works only for SELECT queries and queries must be completely same (order of variables, etc), because if they are not, you will not only have execute query two times to search through mysql table, but also create two identical query caches, thus wasting time and memory.
You may also be interested in:
Powered by BlogAlike.com