oracle 物化视图中的完全刷新和快速刷新有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41465445/
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
What is the difference between complete refresh and fast refresh in materialized view?
提问by MFARKAN
I have materialized view in my own schema and the materialized view source is the other schema table but , this master table has 900 rows and i did some dml operations on this master table after that i will refresh this materialized view as you know , and i did some resarch " how can i refresh my own materialized view " and it says " you can do complete refresh or fast refresh " but i didnt understand these solutions meaning so my question is simple ;
我在我自己的模式中有物化视图,物化视图源是另一个模式表,但是,这个主表有 900 行,我在这个主表上做了一些 dml 操作之后我会刷新这个物化视图,正如你所知,我做了一些研究“我如何刷新我自己的物化视图”,它说“你可以完全刷新或快速刷新”,但我不明白这些解决方案的含义,所以我的问题很简单;
What is the difference between complete refresh and fast refresh in MV ?
MV中的完全刷新和快速刷新有什么区别?
P.S:If my master table has 1 million or more rows , which one i should choose? (fast or complete)
PS:如果我的主表有 100 万行或更多行,我应该选择哪一个?(快速或完整)
Thank you for your reply.
感谢你的回复。
回答by Wernfried Domscheit
"Complete Refresh" means you truncate entire materialized view and insert new data.
“完全刷新”意味着您截断整个物化视图并插入新数据。
"Fast Refresh" means you update (or insert/delete) only the rows which have been changed on master tables.
“快速刷新”意味着您只更新(或插入/删除)主表上已更改的行。
And just as information "Force Refresh" mean, Oracle tries to make a Fast Refresh and if this is not possible then do "Complete Refresh"
正如信息“强制刷新”的意思一样,Oracle 尝试进行快速刷新,如果这不可能,则执行“完全刷新”
Usually Fast Refresh is much faster than Complete Refresh but it has restrictions. You have to define MATERIALIZED VIEW LOG
on master tables.
通常快速刷新比完全刷新快得多,但它有限制。您必须MATERIALIZED VIEW LOG
在主表上定义。
Here is a full list of restrictions General Restrictions on Fast Refresh, there are quite many.
这是限制的完整列表Fast Refresh 的一般限制,有很多。
回答by ewramner
As always it depends, so if possible try both and measure for your application. As a general rule the fast refresh is likely to be much faster provided that only a small part of the data has changed. If all the data has changed a complete refresh is better.
与往常一样,视情况而定,因此如果可能,请尝试两者并针对您的应用进行测量。作为一般规则,如果只有一小部分数据发生了变化,快速刷新可能会快得多。如果所有数据都已更改,则最好进行完整刷新。
With the fast refresh Oracle keeps track of the changes for the base tables and applies the changes to the materialized view when it is refreshed. A complete refresh on the other hand rebuilds the materialized view from scratch. With millions of rows that will be expensive, but again it is impossible to pick the best option without knowing more about your application.
通过快速刷新,Oracle 会跟踪基表的更改,并在刷新时将更改应用到物化视图。另一方面,完全刷新会从头开始重建物化视图。数以百万计的行会很昂贵,但如果不了解更多关于您的应用程序的信息,就不可能选择最佳选项。