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
This is actually what we advise as it's much simpler than treating each table separatly.
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.
0 Comments