fra*_*976 1 sql-server performance views
如果我在SQL Server中定义了一个视图,如下所示:
CREATE View V1
AS
SELECT *
FROM t1
INNER JOIN t2 ON t1.f1 = t2.f2
ORDER BY t1.f1
Run Code Online (Sandbox Code Playgroud)
我应该期待之间的性能差异
SELECT * FROM V1 WHERE V1.f1 = 100
Run Code Online (Sandbox Code Playgroud)
并且像这样避免观看
SELECT *
FROM t1
INNER JOIN t2 ON t1.f1 = t2.f2
WHERE t1.f1 = 100
ORDER BY t1.f1
Run Code Online (Sandbox Code Playgroud)
?
除了需要集中复杂查询之外,我们没有任何理由使用视图.
谢谢