首页 > 解决方案 > 从另一个视图创建视图是否有任何惩罚?

问题描述

我有历史化的表,然后从它们创建视图以仅保留最新和活动的数据。

我想制作将其中一些视图聚合在一起的视图,我将在其中将我的视图创建为SELECT * FROM {Other view(s)}。所以有点像这样:

表 -> 中间视图 -> 聚合视图

我只是想知道如果我的观点基于其他观点,我是否会遇到任何性能损失。我是否应该让我的聚合视图在代码方面更复杂,但直接基于基础表?

表 -> 聚合视图

还是根本没有区别?

非常感谢。

标签: snowflake-cloud-data-platform

解决方案


From a performance viewpoint, it doesn't make any difference - unless you are making your view out of a single table, in which case you would be able to Materialize your view - in fact, one of the biggest limitations of Materialized Views is that the FROM has to refer to a single table.

From a software engineering viewpoint, I see many advantages like more reusable work and more flexible and, potentially, faster development (while developer-A works on View-A, developer-B works on View-B, and developer-C could even work on View-C to combine View-A and View-C).

The downside is the increase in complexity of the lineage of the views which might require a graphical representation in some cases where objects are too many.


推荐阅读