Think of x as a column containing null, 0, 1. Only less than 1 % of the rows contain 1. There is no logical difference between 0 and Null.
Is it a good idea to insist, that isnull rather than NVL is used here (performance) ?
|
Think of x as a column containing null, 0, 1. Only less than 1 % of the rows contain 1. There is no logical difference between 0 and Null. Is it a good idea to insist, that isnull rather than NVL is used here (performance) ? |
|||||||||
|
|
If you're looking at it purely from just what's better from a performance perspective ... I'd just test both of your methods and see what's faster for your data. ... but as you only have three states anyway, and this is going in a where clause, it might be even faster to just check that it's not the third case, and then you don't need the NVL test:
Or, if there really is no difference (and NULL isn't a case of 'we don't know, so we're going to treat it for all practical purposes that it's 0, but we occassionally need to know when it's unknown'), just update the table and set it to 0 where it's currently NULL. (and adjust whatever's feeding in the NULLs) |
|||
|
|
It depends but given the data distribution, probably not. The performance benefit of using a single expression like |
|||
|
|