My question is purely about mysql. I have a wordpress application. My application database has a table named wp_options which grows very fast. This is a InnoDB table. My table size grew to 800 GB while mysqldump of table was less than 1 GB. This made me suspicious that table is fragmented due to frequent delete and updates. When I ran "optimize table" it reduced the size of table to 1 GB so my analysis also seemed to be correct.
My problem is with table info. Table info showed that 'Data length' was 800GB and 'Data free' was only 5 MB. As per mysql Table info there was no fragmentation. The result of following query was also similar -
select ENGINE, TABLE_NAME,Round( DATA_LENGTH/1024/1024) as data_length , round(INDEX_LENGTH/1024/1024) as index_length, round(DATA_FREE/ 1024/1024) as data_free from information_schema.tables where DATA_FREE > 0 and TABLE_NAME='wp_options';
ENGINE, TABLE_NAME, data_length, index_length, data_free 'InnoDB', 'wp_options','812128','2','5'
does it mean Table info is misleading and incorrect here? If yes then how does one really know if table is fragmented?