gpt4 book ai didi

database - 物化 View 用例

转载 作者:行者123 更新时间:2023-12-05 04:16:38 27 4
gpt4 key购买 nike

我一直在学习物化 View 以及它们的用途/用途。

但是我没有发现它有什么用处,因为它不包含当前数据,因为它需要时间来刷新/更新。还要查看现实生活中的场景,它用于 a.) 减轻网络负载和 b.) 根据 oracle 文档启用数据子集等。现在,如果我有用于减少负载的本地化服务器,我可以自己创建一个本地化数据库,它将迎合特定国家/地区的谷歌服务器的本地数据。

如果有人能解释为什么在现实生活中使用物化 View 。

最佳答案

why materialized views are used in real life situations.

原因有很多,这取决于系统、应用程序、需求等。如果你想自动保持数据与基表同步,那么你不需要为此编写自己的代码。 Oracle 会自动为您完成。

另一件事是查询重写。如果启用,优化器可以使用实体化 View 进行查询。

有用,

  1. 数据仓库
  2. 分布式计算
  3. 移动计算

来自文档,

The Need for Materialized Views

You can use materialized views to increase the speed of queries on very large databases. Queries to large databases often involve joins between tables, aggregations such as SUM, or both. These operations are expensive in terms of time and processing power. The type of materialized view you create determines how the materialized view is refreshed and used by query rewrite.

Materialized views improve query performance by precalculating expensive join and aggregation operations on the database prior to execution and storing the results in the database. The query optimizer automatically recognizes when an existing materialized view can and should be used to satisfy a request. It then transparently rewrites the request to use the materialized view. Queries go directly to the materialized view and not to the underlying detail tables. In general, rewriting queries to use materialized views rather than detail tables improves response time.

这里有人提出了类似的问题 https://dba.stackexchange.com/questions/23280/why-not-use-a-table-instead-of-a-materialized-view

关于database - 物化 View 用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26647897/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com