Sign-up our Newsletter  Register on our LinkedIn  Follow us on Twitter  Check out our Facebook  Follow us on Google+

When I delete some data in XStudio, my database doesn't get smaller

By default, when you delete some data in a innodb table, the file hosting the data doesn't get smaller.
This is normal.

To get it smaller you need to "defragement" the file.
To do so, MySql (and other database server providers) provides some special commands.
For most of all the database server, the OPTIMIZE TABLE query can do it for you.
You need to run this on all the tables you want to optimize.
This can be executed from your standard Database server management console or even in a command line exactly like a stadard SQL query.

You can check your database provider's documentation for more details. For instance:
MySql / MariaDb

WARNING: If your MySql database server has not the innodb_file_per_table configuration parameter set, OPTIMIZE TABLE will not work and in this case the only way to optimize the database is to create an SQL dump of the whole database, empty the database and reload the dump.

This is actually what we advise as it's much simpler than treating each table separatly.


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.