问题
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