I’m using various boolean flags in my tables, and from reading a bit about optimizing performance I came across a widespread tip to avoid using boolean flags.
What are the effective alternatives? Some examples would be much appreciated.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In
MySQL,BOOLEANis just an alias forTINYINT(1).This means that boolean operations are in fact integer operation.
That, among other things, means that in a query like this:
an index on
boolean_flag, if any, may be used, while in this one:the index will not be used.