今天同事问我overhead是什么意思,其实说实话我也没有碰到过这个东东,毕竟阅历有限。google了一下,发现是phpMyAdmin上面经常出现的,然后还发现一个哥们对这个overhead比较形象的解释:
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.
具体意思就不翻译了,反正是用车子汽油做的比喻,但是太泛泛了我觉得。
比较技术的解释我认为是这样,MySQL处理可变长度的列或者大数据类型的列(VARCHAR, VARBINARY, BLOB, or TEXT)时,由于长度是不定的,更新(对数据库而言就是删除+新增)或者删除之后相应的空间保留,新增的部分重新分配。时间一长,浪费的“空“空间就会越来越多,就是overhead。只要用phpMyAdmin中的Optimize Table选项就能解决。
其实这个和SQL Server中的收缩表数据空间(mdf文件)一样,产生的原因一样,只是操作的名字不同。ldf这种日志文件怎不同,它不存在浪费的空间这种概念,因为所有的操作都是一个经历!它只要截断或者事务日志备份(包括截断步骤),收缩即可,或者是不收缩直接使用也不会变大了,重用空间的一个过程。
MVCC中的delete version如果碰到char这种定长的数据类型,估计能重用,但是能先保存delete version。
标签: delete version, myisam, overhead, phpMyAdmin