oracle 编译和刷新物化视图有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7561954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:19:49  来源:igfitidea点击:

What's the difference between compiling and refreshing a materialized view?

sqloraclematerialized-views

提问by jldugger

We just ran into a problem where materialized views weren't refreshing, and giving a compile error. One of the senior developers says he just figured out how to fix it -- by telling toad to compile the materialized view.

我们刚刚遇到了一个问题,即物化视图没有刷新,并给出编译错误。一位高级开发人员说他刚刚想出了如何修复它——通过告诉蟾蜍编译物化视图。

So my question is pretty simple: what's the difference between a refresh and a "compile"?

所以我的问题很简单:刷新和“编译”有什么区别?

回答by DCookie

A Refresh of a materialized view is a data operation. The data in the MV is brought up to date as specified when the view was created, e.g., fast refresh, complete refresh, etc.

物化视图的刷新是一种数据操作。MV 中的数据按照创建视图时的指定更新,例如快速刷新、完全刷新等。

When you compile the MV, Oracle revalidates the query upon which the view is based. Your MV may be invalid due to changes in one or more of the underlying objects upon which the MV is based.

当您编译 MV 时,Oracle 会重新验证视图所基于的查询。您的 MV 可能会因 MV 所基于的一个或多个基础对象的更改而无效。

回答by Tony Andrews

A refreshupdates the data that the materialized view holds. This cannot be done if the materialized view's definition is invalid.

一个刷新更新物化视图保存数据。如果物化视图的定义无效,则无法执行此操作。

A compilevalidates the definition of the materialized view, i.e. that the SQL is valid and that the objects it relies on exist.

一个编译验证的定义物化视图,即该SQL是有效的,而且对象是依赖于存在。

回答by William Michael

Compile = validation and run

编译 = 验证并运行

Refresh = resubmitting the data. It holds the same meaning and definition as it does outside of programming.

刷新 = 重新提交数据。它具有与编程之外相同的含义和定义。