Hello,
I’ve encountered a potential issue with the reporting of the DATA_FREE
value for partitioned tables in MySQL (5.7.42-46).
When I run SHOW TABLE STATUS LIKE 'testtab';
, I get a DATA_FREE
value of 47555018752
.
However, when I query the information_schema.PARTITIONS
table with the following command:
SELECT
TABLE_SCHEMA,
TABLE_NAME,
PARTITION_NAME,
DATA_LENGTH,
DATA_FREE
FROM
information_schema.PARTITIONS
WHERE
TABLE_NAME='testtab'
AND DATA_FREE>0;
I get an empty set, indicating that there’s no DATA_FREE
space.
But, when I query the information_schema.TABLES
table with the following command:
SELECT
TABLE_SCHEMA,
TABLE_NAME,
DATA_LENGTH,
DATA_FREE
FROM
information_schema.TABLES
WHERE
TABLE_NAME='testtab'
AND DATA_FREE>0;
I get a DATA_FREE
value of 47555018752
, which matches the value from the SHOW TABLE STATUS
command.
According to the MySQL documentation, the DATA_FREE
column in the PARTITIONS
table should show “The number of bytes allocated to the partition or subpartition but not used.” However, it seems like this value is not being properly reported for partitioned tables.
I’ve tried running ANALYZE TABLE
to gather fresh statistics, but it didn’t help. It seems like this might be a bug.
Could you please look into this issue and provide some guidance on how to resolve it?
Thank you for your time and assistance.
Best regards,
Marko