![]() |
||
| Home| Download |Features |WebTuna Analytics |Knowledge Base |Buy | ||
The MySQL Optimize Table Command The MySQL Optimize Table command will effectively de-fragment a mysql table and is very useful for tables which are frequently updated and/or deleted. Example: We have a table called articles which has many thousands of rows which are often inserted, updated and deleted. We can see from the table description below that the table contains variable length column data types: mysql> desc articles; If we look at the size of the table on disk we can see that it around 190MB. If we query the table on a column which is indexes we can see the average query response time: e.g. mysql> select count(*) from articles where article_title like 'The%'; If we now optimize the table with the following command: mysql> optimize table articles; This has the effect of defragmenting the table and reducing the size of the table on disk down to 105MB. It also has a very positive affect on query performance, reducing the select query response time from 0.63 to 0.39 seconds. N.B. the mysql query cache was turned off to demonstrate. mysql> select count(*) from articles where article_title like 'The%';
To monitor the performance of MySQL (and Oracle and SQL Server) try DBTuna today! Click here to register for a free download. |
||
|
Copyright ©2010 DBTuna. All rights reserved. |
||