For Boolean purpose column which one is better: nullable char(0)
or tinyint(1)
.
I know bool is an alias for tinyint(1) , but in "High Performance MySQL" book that published by O'reilly said:
"If you want to store a true/false value in a single bit of storage
space, another option is to create a nullable CHAR(0) column. This
column is capable of storing either the absence of a value (NULL) or a
zero-length value (the empty string). "
which one is better for size, performance, indexing or …
UPDATE:
I found this link useful for this question:
Efficient Boolean value storage for Innodb Tables
Best Answer
You should keep in mind it is impossible to index a CHAR(0) column, even as part of a compound index.
In terms of size nothing beats NULLable CHAR(0); but how many of these do you have? As compared to other data types in your table? Typically when compared to overall data types & size this is neglect-able.
The clearest is BOOL/TINYINT UNSIGNED. It is most obvious what values are expected.
Otherwise please consider many alternatives in my post, and please see good ideas on comments: Choosing MySQL boolean data types