Is IN with the multiple of the same values slower?

匆匆过客 提交于 2019-12-24 02:29:25

问题


For example, is this noticeably slower:

DELETE FROM [table] WHERE [REOID] IN ( 1, 1, 1, 2, 2, 1, 3, 5)

Than this:

DELETE FROM [table] WHERE [REOID] IN ( 1, 2, 3, 4)

SQL Server 2008 R2.

Thanks!


回答1:


Most engines would eliminate duplicates in the constant IN list on parsing stage.

Such a query would parse marginally slower than that with a non-duplicated list, will produce the same plan and with most real-world scenarios, you will hardly notice any difference.



来源:https://stackoverflow.com/questions/10901238/is-in-with-the-multiple-of-the-same-values-slower

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