For some reason, all InnoDB tables in my MySQL server are being listed as fragmented when I run mysqltuner. I only installed the server a few hours ago (on OSX Lion), and it has a bunch of fresh data imported from batch files in it.
I tried converting all the tables in one database to MYISAM, and sure enough the number of fragmented tables went down. Strangely though, as soon as I converted those tables back to InnoDB the fragmented table count shot back up again. This is contrary to my research so far which suggests that running ALTER TABLE table_name ENGINE=INNODB; should fix the fragmentation.
After a bit of Googling I ran:
SELECT table_schema, table_name, data_free/1024/1024 AS data_free_MB
FROM information_schema.tables
WHERE engine LIKE 'InnoDB' AND data_free > 0
Which supposedly lists all fragmented tables (it does indeed return the same number of results as mysqltuner outputs for the fragmented table count). Every single entry has exactly the same number in the data_free_MB column (currently 7.00000000).
Is this actually a real problem or something mysqltuner is doing wrong? If it is a problem, how do I fix it?
EDIT
I'm becoming more and more suspicious that I'm an idiot and that the 7MB fragmentation is for the whole file, not for each table. Can anyone confirm if that would be the case?
[!!] Total fragmented tables: 2314, which I'm pretty sure indicates a problem (with the double red exclamation marks) – Clive Aug 15 '12 at 12:48