“NULL columns require additional space in the row to record whether their values are NULL. For MyISAM tables, each NULL column takes one bit extra, rounded up to the nearest byte.”
尽可能避免NULL:应该指定列为NOT NULL,除非你想存储NULL。在MySQL中,含有空值的列很难进行查询优化。
Mysql难以优化引用可空列查询,它会使索引、索引统计和值更加复杂。可空列须要更多的存储空间(见上面的e文),还须要mysql内部进行特殊处理。可空列被索引后,每条记录都须要一个额外的字节,还能致使MYisam 中固定大小的索引变成可变大小的索引。这也是《高性能mysql第二版》介绍的。 mysql