View Single Post
  #1 (permalink)  
Old 08-04-2007, 02:58 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default MySQL Query Performance Tips

Hi All,

Here is a simple tip to improve the query performance in MYSQL DB Server.

In common, MYSQL server recives a request it will parse it and retrives data from database and send it back to the client.

In the situation we need to get the result of the similar query several times but differs in the condition which is dynamic then the server will just sent the result from CACHE.

Enable caching in MySQL

Setting the Query Cache Size

mysql> SET GLOBAL query_cache_size = 16777216;

Setting up quey caching in config file

mysql> vi /etc/my.cnf

Quey CACHE System Variables

query_cache_size
Size of the cache query in Bytes.
query_cache_type
a. 0 -> Don’t cache results in or retrieve results from the query cache.
b. 1 -> Cache all query results except for those that begin with SELECT S_NO_CACHE.
c. 2 -> Cache results only for queries that begin with SELECT SQL_CACHE
query_cache_limit
The Limit of the Cached query in Bytes.

Try this to Enable the Query CACHE,

Quote:


SET GLOBAL query_cache_size = 268435456;
SET GLOBAL query_cache_limit=1048576;
SET query_cache_type=1;


__________________
-Murali..
Reply With Quote
Sponsored Links