How to shrik or optimize table in mySQL database

Hi All,

I want shrink table in MYSQL database, Please let me know the steps and requirements.

1.Query for Shrink
2.Is there any space requirement  for table Shrink
3.how to calculate required space for table shrink.

Please some help me with script and calculations.


Regards,
GK GKAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
1: optimize table
http://dev.mysql.com/doc/refman/5.0/en/optimize-table.html
followed by this statement:
FLUSH TABLES;

2 & 3: yes, the space needed for the resulting table size (as the table is rebuild side-by-side) and then the old one is replaced/deleted. so, if you table has 1MB size, you will need max 1 more MB free space for this
0
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
There is the OPTIMIZE TABLE command but I don't think there is any way to calculate the results.
http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html
0
 
GK GKAuthor Commented:
Thanks for update
0
All Courses

From novice to tech pro — start learning today.