Tuesday, March 8, 2011

Optimize a database in Mysql

In case you remove a lot of data from the tables OR change the database structure, a de-fragmentation/optimizing of the database is necessary to avoid performance loss, especially while running queries. The above changes results in a performance loss, so make sure you run the “optimizer” on the database.
SSH to your server and execute:  
mysqlcheck -o  (where, -o stands for optimize)
You should look to defragment the tables regularly when using VARCHAR fields since these coloumns get fragmented too often.

OR you can follow below steps:
1.Go to phpMyAdmin and select your database. check all to select all tables of the database
3.In the drop down menu, click optimize tables .


No comments:

Post a Comment