If that is all you need1, then just add the simple field.
But, you'll have to be careful about how you index it. Unless the values are seriously skewed2, you'll end-up with an index with a horrible selectivity and clustering factor3, and you'll actually be better off doing full table scans4.
如果您按标志过滤结合起来与其他字段一起创建一个综合索引,这样就有更好的机会进行适当的选择。
1 I.e. you don't need additional data that somehow "describes" or "augments" each of the two possible Boolean values.
2 One value is in deep minority (the number of rows containing false
is much smaller than the number of rows containing true
, or vice verse), and you happen to filter on just that value.
3 The link is for Oracle, but the general principle applies to all DBMSes.
4 Which a decent DBMS will do for you automatically, even in the presence of the index. A hypothetical "stupid" DBMS would just blindly use the index and perform even worse than the full table scan.