We have a table that has either NULL or "Accepted" as values. My query returns about 250 rows.
If I add a where condition of -
AND Description = 'Accepted'
my 250 rows return in 2 seconds.
However, if I add a where condition of -
ISNULL(Description, '') = 'Accepted'
my 250 rows return in 47 seconds.
Has anyone encountered performance issues with using the ISNULL function? Unfortunately I am programatically limited to having to use ISNULL at this point.
When you include a field inside of a function, it changes how the optimizer has to run and forces it to ignore indexes.
see here: What makes a SQL statement sargable?
You can also bypass the functions entirely by using:
WHERE (Description = 'Accepted' OR Description IS NULL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With