mysql 字段用null,MySQL:NULL字段使用多少空间?

Does making a datum NULL save any memory versus its normal size?

解决方案

This is discussed in the MySQL manual chapter on Storage Requirements. There is no simple answer; it depends on the data type of the column, whether the column is indexed; and the storage engine. The impact of using NULL for a column can vary from nothing to several bytes (depending on how many other columns are also NULL-able.)

The storage impact of declaring a column as accepting NULL, and of actually storing a NULL value, is probably minor. Having a column with lots of NULL values often indicates a need for (further) normalization.

The basic rule is, design your schema based on the properties of the data, not on the storage impact. Fix things only if they turn out to be a problem.

你可能感兴趣的:(mysql,字段用null)