简体   繁体   English

在视图及其基础表上运行查询之间的区别

[英]Difference between running a query over a view and its underlying tables

Is there a difference, in performance or otherwise, between running a query over a view or there underlying tables. 在视图或基础表上运行查询之间,在性能上是否有差异?

There may be aggregations, sorting involved in the query. 查询中可能涉及聚合,排序。

Any resources where this subject is dealt is welcome. 欢迎处理此主题的任何资源。

Ideally a View is just a projection on the underlying tables with optional criteria, generally used to hide certain columns or simplify the complexity involved in joining multiple tables to achieve a particular task etc., and wouldn't have any physical existence in the database. 理想情况下,视图只是具有可选条件的基础表的投影,通常用于隐藏某些列或简化连接多个表以实现特定任务等所涉及的复杂性,并且数据库中不存在任何物理存在。 So, a query that is run on the view and a query same as the previous one run on the underlying tables perform in the same way. 因此,在视图上运行的查询和与在基础表上运行的上一个查询相同的查询的执行方式相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM