Is it more efficient to store 0 and 1 for a binary value or just empty and 1 in MySQL Is it more efficient to store 0 and 1 for a binary value indicating whether a flag is up or down or just empty and then set 1 for rows where the flag is up. Using MySQL.

E.g.

Flag
0
1
1
0
0


Or

Flag
''
1
1
''
''
Performance wise

a statement could be made that inserting would be faster when the flag is down as the field doesn't need to be included in the insert clause.

On the other hand, selecting all records where the flag is down could be slower because in the end, somewhere you need to make a conversion from NULL to 0.

As any performance difference that might exist will not be noticable, let's call this a draw.

Storage wise

I'm operating here under the assumption that you are actually using the BOOL datatype. Likely the reasoning holds for other types as well but that should be looked at on a case by case basis.

The BOOL's datatype underlying storage is a TINYINT(1) wich makes up for 1 Byte. The storage requirement is the same for 0, 1 or NULL so you don't gain anything here.

Again a draw.

But that's all moot...

... because in the end, you should use what is most maintainable. Rest assured that being explicit about your values is much more maintainable than having to convert them back and forth everywhere you use that field.