sql-server - 查询优化(IN 与等于)
问题描述
它只是为了知识。
你能告诉我哪个是以下两个的优化查询吗:(请注意我只有 1 个字符串要传递)
select * from crm_prod..profile where first_name = 'Nishant';
select * from crm_prod..profile where first_name in ('Nishant');
在此先感谢 Nishant Khanna
解决方案
两者都是一样的。查询优化器会将其转换为相同的计划。
"In" 用于多个值,内部用于 sql server 将被转换为 (Name = "nishant" or name = "secondvalue" or name = "...." ) 等等
推荐阅读
- java - 打模式报警关闭应用
- typo3 - 无法使用通配符或子上下文的 TypoScript applicationContext 条件
- matlab - 参考 MATLAB 中的第二个函数输出
- entity-framework - 如何在包管理器控制台中获取实体框架的可用命令列表
- java - 当我构建项目时,为同一个 .java 文件多次生成的 .class 文件
- c# - 如何在 RichTextBox 的 rtf 代码中获取插入符号的位置?
- c# - 创建帐户时自动 Defender 令牌
- java - 插入性能:在开始时使用 HashSet 与在开始时使用 ArrayList 并在末尾使用 hashset 删除重复项
- python - 为什么我没有得到输出,也没有网页抓取错误?
- c++ - 缩放 SVG 而不改变其在 C++ 中的位置