0

In performance terms, what will be faster, use a BIT(1) NULL (null = unknown, 0 = male, 1 = female) or ENUM('unknown', 'male', 'female') NOT NULL DEFAULT 'unknown' in MySQL MyISAM?

Or this is considered micro-optimization?

[EDIT]

I think I'm going to use ENUM('male', 'female') DEFAULT NULL

4

2 回答 2

4

Yes, this is microoptimization. Performance will be dominated by other things, and anyway nullable fields take more space (for a null flag) so use the meaningful enumeration.

于 2010-08-24T11:03:03.453 回答
1

我认为这种微优化。

我会选择 ENUM 选项,因为所有值的含义都是完全清楚的,无需阅读文档。位选项有点模糊。

关于性能,我似乎记得 NULL 通常很糟糕,但现在找不到参考。

于 2010-08-24T11:07:57.607 回答