If I understand your question correctly, you are asking about the relative advantages / problems with two situations:
- where is_paying = 0
- where payment is null
Given that both are in the data table, I cannot think of why one could work better than the others. I really think that in the first place itβs clear what the request is doing, so this is the option I would prefer. But in terms of performance, they should be the same.
Someone else mentioned - and I'm sure you know that NULL and 0 are different animals. They can also behave differently in optimizing joins and other elements. But for simple filtering, I would expect them to have the same performance.
Well, there is one technical responsibility. Comparison with "0" is probably built into the CPU. Comparing with NULL is probably a small operation requiring something like a mask, offset, and comparison β which can take longer. However, this performance difference is negligible compared to the fact that you are reading data from disk to begin with.
source share