SQL Server查询 - 哪个性能更好?

时间:2016-11-07 05:29:55

标签: sql sql-server query-performance

我认为查询1比查询2更具可读性,但我想知道它们在性能方面是否存在差异?

查询1

UPDATE table_1
SET col_1 = value1
FROM table_1
LEFT JOIN table_2 ON table_1.col_pk = table_2.col_pk
WHERE table_1.col_pk IS NULL

UPDATE table_1
SET col_1 = value2
FROM table_1
INNER JOIN table_2 ON table_1.col_pk = table_2.col_pk

查询2

{{1}}

1 个答案:

答案 0 :(得分:3)

第一个查询可能会有更好的效果,因为它只需要对table_1table_2进行一次扫描。