Tuesday, January 4, 2011

Disadvantages of Creating Many Tables in the Same Database

If we have many MyISAM tables in the same database directory, open, close, and create operations are slow. If we execute SELECT statements on many different tables, there is a little overhead when the table cache is full, because for every table that has to be opened, another must be closed. We can reduce this overhead by increasing the number of entries permitted in the table cache.

We can set the table_cache value in the my.cnf file by
set-variable = table_cache=8
Or
If we have the SUPER privilege then, use
set GLOBAL table_cache=8;

since the Variable 'table_cache' is a GLOBAL variable it should be set with SET GLOBAL