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
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.
I consider this micro-optimization.
I would go for the ENUM option, because the meaning of all values is completely clear without reading documentation. The bit option is a bit vague.
Regarding performance, I seem to remember NULL is usually bad, but can't find references right now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.