Zero Space for False
Whatever your choice, you can set NULL instead of 0 , and it wonβt take up too much space (since the database almost always has a NULL flag for each field of each row, it just sits there; more information here ). If you also make sure that the default / most likely value is false , you will save even more space!
Some space for True
The value for representing true requires the space defined by the field type; using BIT will only save space if the table has several such columns, since it uses one byte per 8 fields (compared to TINYINT , which uses one byte per field).
TINYINT has the advantage that you can set the 8-value bitmask without worrying about managing many additional columns, and the search is theoretically faster (one whole field compared to several bit fields). But there are some flaws, such as slow ordering, fancy cross-indexing material, and lack of field names. Which for me is the biggest loss; Your database will need external documentation to note which bits did what the bitmasks did.
In any case, avoid the temptation to use TEXT fields to store logical or sets of them. Searching through text is a lot more work for the server, and arbitrary naming schemes such as on, off, off can damage interoperability.
Beejor Jul 17 '15 at 18:14 2015-07-17 18:14
source share