I've been reading through some of guides on database optimization and best practices and a lot of them suggest not using boolean flags at all in the DB schema (ex http://forge.mysql.com/wiki/Top10SQLPerformanceTips). However, they never provide any reason as to why this is bad. Is it a peformance issue? is it hard to index or query properly?
Furthermore, if boolean flags are bad, what should you use to store boolean values in a database? Is it better to store boolean flags as an integer and use a bitmask? This seems like it would be less readable.
I don't think it is bad and I've never seen a reason stated for this either. Perhaps some old database engines couldn't store them efficiently, but modern ones do. As you say, it's a lot more readable to use booleans than bitmasks. See this question for a similar discussion: Is adding a bit mask to all tables in a database useful?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With