Pages

Saturday 25 June 2011

Enabling Query Cache for fast query execution in MySQL

1. Open the MySQL Console

2. Enter SET GLOBAL query_cache_size = 1048576;
(Size is in KBs, 1GB = 1x1024x1024=1048576)

3. Other Cache Related Settings includes
SET GLOBAL query_cache_type=1;
(To Enable Query Cache)
SET GLOBAL query_cache_limit=1024;
(Per User 1MB 1x1024)

4. Caching speeds up the fetching of queries, the size must be chosen according as the RAM size

5. To check their values, you can run command
SHOW VARIABLES LIKE 'query%';

Note: To run mysql in terminal: mysql -u root -p

No comments:

Post a Comment