simple question, but its been nagging me for a while now....
what is "overhead" in MySQL, and should i be worried?
does clicking "optimize table" fix it for real?
simple question, but its been nagging me for a while now....
what is "overhead" in MySQL, and should i be worried?
does clicking "optimize table" fix it for real?
Overhead is Data_free of a table, that is The number of allocated but unused bytes. We can find it by SQL command SHOW TABLE STATUS. It is the free space in allocated size for your table.
It appears that the overhead is temporary diskspace that the database used to run some of the queries, so you should only worry if this gets really high.
You can compare 'Optimizing the table' with the defragmenting of your hard drive.
I quote:
Optimize table can be very problematic. For example if the table is used heavily on a site.
http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html
I believe I've confirmed this behaviour. And it would certainly be very useful indeed.
If you are talking about the thing that
phpMyAdmin
callsoverhead
, then it's actual size of a table datafile relative to the ideal size of the same datafile (as if when just restored from backup).For performance reasons,
MySQL
does not compact the datafiles after it deletes or updates rows.This
overhead
is bad for table scan, i. e. when your query needs to run over all table values, it will need to look at more empty space.You may get rid of the
overhead
by runningOPTIMIZE TABLE
that will compact your table and indexes.