This is an elegant solution that I quite appreciate because it uses zero data bytes:
some_flag CHAR(0) DEFAULT NULL
To set it to true, set
some_flag = ''
and to set it to false, setsome_flag = NULL
.Then to test for true, check if some_flag
IS NOT NULL
, and to test for false, check if some_flagIS NULL
.(This method is described in "High Performance MySQL: Optimization, Backups, Replication, and More" by Jon Warren Lentz, Baron Schwartz and Arjen Lentz.)
I can't say it is good for ORMs though.