2012-10-18

Turn on MySQL Cache to speed up query

The simplest way to speed up your MySQL query, is to enable the cache.

You can modify the ini directly, or use command line instead.
Here is the command to check if your MySQL server enable the cache:
SHOW VARIABLES LIKE '%query_cache%';
You can turn on cache by following command:
SET @@global.query_cache_type=1;
0 = disable
1 = enable
2 = on demand. If you set this type, you need to modify your SQL to support cache

Also don't forget to config your cache size:
SET @@global.query_cache_size=16777216;
This example we allocate 16GB as cache.

No comments: