I created few indexes on a table that has 1M records and the index_length was increased then dropped the indexes which I created but the index_length is not reducing back. Using the below query to see the details
SELECT TABLE_NAME, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "dbname"
ORDER BY (data_length + index_length) DESC;
Any inputs on this much appreciated. TIA
In general MySQL InnoDB does not release disk space after deleting data rows from the table. It keeps the space to reuse it later.
OPTIMIZE TABLE reorganizes the physical storage of table data and associated index data, to reduce storage space and improve I/O efficiency when accessing the table. The exact changes made to each table depending on the storage engine used by that table.
Look MySQL Documentation for more information
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With