首页 > 解决方案 > 查询优化(IN 与等于)

问题描述

它只是为了知识。

你能告诉我哪个是以下两个的优化查询吗:(请注意我只有 1 个字符串要传递)

select * from crm_prod..profile where first_name = 'Nishant';

select * from crm_prod..profile where first_name in ('Nishant');

在此先感谢 Nishant Khanna

标签: sql-server

解决方案


两者都是一样的。查询优化器会将其转换为相同的计划。

"In" 用于多个值,内部用于 sql server 将被转换为 (Name = "nishant" or name = "secondvalue" or name = "...." ) 等等


推荐阅读