In MySQL what does "Overhead" mean, what is bad about it, and how to fix it?

johnnietheblack picture johnnietheblack · Feb 19, 2009 · Viewed 94.1k times · Source

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?

Answer

Jasper picture Jasper · Feb 19, 2009

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:

Every database will, over time, require some form of maintenance to keep it at an optimal performance level. Purging deleted rows, resequencing, compressing, managing index paths, defragmenting, etc. is what is known as OPTIMIZATION in mysql and other terms in other databases. For example, IBM DB2/400 calls it REORGANIZE PHYSICAL FILE MEMBER.

It's kind of like changing the oil in your car or getting a tune-up. You may think you really don't have to, but by doing so your car runs much better, you get better gas mileage, etc. A car that gets lots of mileage requires tune-ups more often. A database that gets heavy use requires the same. If you are doing a lot of UPDATE and/or DELETE operations, and especially if your tables have variable length columns (VARCHAR, TEXT, etc), you need to keep 'er tuned up.