This is part 2, you can find part 1 here.
So in part 1 we learned how to calculate the free space within
InnoDB. But unfortunately that won't always work perfectly.
The first issue: the DATA_FREE column in the
INFORMATION_SCHEMA.TABLES table will not show a sum of the free
space of each partition. This means that if you have
innodb_file_per_table disabled and are using partitioning then
you must divide DATA_FREE by the number of partitions.
This is Bug #36312.
Example:
mysql> SELECT CONCAT(T.TABLE_SCHEMA,'.',T.TABLE_NAME) AS TABLE_NAME,[Read more]
-> P.PARTITION_NAME AS PART,IBT.SPACE,IBD.PATH,T.DATA_FREE AS T_DATA_FREE,
-> P.DATA_FREE AS P_DATA_FREE FROM INFORMATION_SCHEMA.TABLES T
-> LEFT …