Differences between “IS NULL” and “ISNULL()” in Mysql

那年仲夏 提交于 2019-12-30 05:43:05

问题


Is there any difference in performance between the operator IS NULL and the function ISNULL()?


回答1:


Looking into the MySQL manual, they seem to be synonyms really.

  • MySQL manual on IS NULL

  • MySQL manual on ISNULL()

and even if they aren't, I would tend to trust the query optimizer to pick the best solution.




回答2:


This thread is similar, though not exactly on MySQL. According to the test shown there:

IS NULL is more efficient as it doesn't require a scan.

Seek is generally faster than a scan as it only includes qualifying records, while scan includes every row. It is explained in more detail here.

Another difference (though it's not performance) is their negation syntax:

IS NOT NULL  /* using NOT operator */
! ISNULL()  /* using exclamation mark */


来源:https://stackoverflow.com/questions/3530124/differences-between-is-null-and-isnull-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!