{"id":14094,"date":"2020-05-10T18:07:01","date_gmt":"2020-05-10T16:07:01","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/"},"modified":"2020-05-10T18:07:01","modified_gmt":"2020-05-10T16:07:01","slug":"oracle-materialized-view-refresh-fast-or-complete","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/","title":{"rendered":"Oracle Materialized View Refresh : Fast or Complete ?"},"content":{"rendered":"<p>In contrary of views, materialized views avoid executing the SQL query for every access by storing the result set of the query.<\/p>\n<p>When a master table is modified, the related materialized view becomes stale and a refresh is necessary to have the materialized view up to date.<\/p>\n<p>I will not show you the materialized view concepts, the <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/19\/dwhsg\/index.html\">Oracle Datawarehouse Guide<\/a> is perfect for that.<\/p>\n<p>I will show you, from a user real case,\u00a0 all steps you have to follow to investigate and tune your materialized view refresh.<\/p>\n<p>And, as very often in performance and tuning task, most of the performance issue comes from the way to write and design your SQL (here the SQL statement loading the materialized view).<\/p>\n<p>&nbsp;<\/p>\n<p>First of all, I&#8217;m saying that spending almost 50 mins (20% of my DWH Load) to refresh materialized view is too much :<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Mview_RT_Before-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-39497 size-full\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Mview_RT_Before-1.jpg\" alt=\"\" width=\"506\" height=\"459\" \/><\/a><\/p>\n<p>The first step is to check which materialized view has the highest refresh time :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SELECT * \nFROM (\n      SELECT OWNER,\n             MVIEW_NAME,\n             CONTAINER_NAME,\n             REFRESH_MODE,\n             REFRESH_METHOD,\n             LAST_REFRESH_TYPE,\n             STALENESS,\n             ROUND((LAST_REFRESH_END_TIME-LAST_REFRESH_DATE)*24*60,2) as REFRESH_TIME_MINS\n       FROM ALL_MVIEWS\n       WHERE LAST_REFRESH_TYPE IN ('FAST','COMPLETE')\n      )\nORDER BY REFRESH_TIME_MINS DESC;\n\nOWNER   MVIEW_NAME                      CONTAINER_NAME                  REFRESH_MODE  REFRESH_METHOD LAST_REFRESH_TYPE STALENESS      REFRESH_TIME_MINS\n------- ------------------------------- ------------------------------- ------------- -------------- ----------------- --------------------------------\nSCORE   MV$SCORE_ST_SI_MESSAGE_HISTORY   MV$SCORE_ST_SI_MESSAGE_HISTORY DEMAND        FAST           FAST              FRESH          32.52\nSCORE   MV$SCORE_ST_SI_MESSAGE           MV$SCORE_ST_SI_MESSAGE         DEMAND        FAST           FAST              FRESH          16.38\nSCORE   MV$SC1_MYHIST2_STOP              MV$SC1_MYHIST2_STOP            DEMAND        FORCE          COMPLETE          NEEDS_COMPILE  .03\nSCORE   MV$SC1_MYHIST2_START             MV$SC1_MYHIST2_START           DEMAND        FORCE          COMPLETE          NEEDS_COMPILE  .03\nSCORE   MV$SC1_RWQ_FG_TOPO               MV$SC1_RWQ_FG_TOPO             DEMAND        FORCE          COMPLETE          NEEDS_COMPILE  .02\n\n<\/pre>\n<p>All the refresh time comes from the mview\u00a0 : MV$SCORE_ST_SI_MESSAGE_HISTORY and MV$SCORE_ST_SI_MESSAGE.<\/p>\n<p>Thanks to columns ALL_MVIEWS.LAST_REFRESH_DATE and ALL_MVIEWS.LAST_REFRESH_END_TIME, we got the sql statements and the executions plans related to the refresh operation :<\/p>\n<p>The first operation is a &#8220;<em>Delete<\/em>&#8220;:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_D_False-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-39500 size-large\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_D_False-3.png\" alt=\"\" width=\"1024\" height=\"241\" \/><\/a><\/p>\n<p>The second operation is an &#8220;<em>Insert<\/em>&#8220;:<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_I_False-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-39502 size-large\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_I_False-2.png\" alt=\"\" width=\"1024\" height=\"309\" \/><\/a><\/p>\n<p>Let&#8217;s extract the PL\/SQL procedure doing the refresh used by the ETL tool :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">dbms_mview.refresh('SCORE.'||l_mview||'','?',atomic_refresh=&gt;FALSE);\n--'?' = Force : If possible, a fast refresh is attempted, otherwise a complete refresh.\n<\/pre>\n<p>Being given that, here all questions which come to me :<\/p>\n<ol>\n<li>My materialized view can be fast-refreshed, so why it takes more than 48 mins to refresh ?<\/li>\n<li>With atomic_refresh set to false, oracle normally optimize refresh by using parallel DML and truncate DDL, so why a &#8220;<em>Delete<\/em>&#8221; operation is done instead a &#8220;<em>Truncate<\/em>&#8221; more faster ?<\/li>\n<\/ol>\n<p>To answer to the first point, to be sure that my materialized view can be fast refresh, we can also use <em>explain_mview<\/em> procedure and check the capability_name called &#8220;REFRESH_FAST&#8221;:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; truncate table mv_capabilities_table;\n\nTable truncated.\n\nSQL&gt; exec dbms_mview.explain_mview('MV$SCORE_ST_SI_MESSAGE_HISTORY');\n\nPL\/SQL procedure successfully completed.\n\nSQL&gt; select capability_name,possible,related_text,msgtxt from mv_capabilities_table;\n\nCAPABILITY_NAME                POSSIBLE             RELATED_TEXT            MSGTXT\n------------------------------ -------------------- ----------------------- ----------------------------------------------------------------------------\nPCT                            N\nREFRESH_COMPLETE               Y\nREFRESH_FAST                   Y\nREWRITE                        Y\nPCT_TABLE                      N                    ST_SI_MESSAGE_HISTORY_H relation is not a partitioned table\nPCT_TABLE                      N                    ST_SI_MESSAGE_HISTORY_V relation is not a partitioned table\nPCT_TABLE                      N                    DWH_CODE                relation is not a partitioned table\nREFRESH_FAST_AFTER_INSERT      Y\nREFRESH_FAST_AFTER_ONETAB_DML  Y\nREFRESH_FAST_AFTER_ANY_DML     Y\nREFRESH_FAST_PCT               N\t\t\t\t\t\t\t\t\t\t\tPCT is not possible on any of the detail tables in the materialized view\nREWRITE_FULL_TEXT_MATCH        Y\nREWRITE_PARTIAL_TEXT_MATCH     Y\nREWRITE_GENERAL                Y\nREWRITE_PCT                    N\t\t\t\t\t\t\t\t\t\t\tgeneral rewrite is not possible or PCT is not possible on any of the detail tables\nPCT_TABLE_REWRITE              N                    ST_SI_MESSAGE_HISTORY_H relation is not a partitioned table\nPCT_TABLE_REWRITE              N                    ST_SI_MESSAGE_HISTORY_V relation is not a partitioned table\nPCT_TABLE_REWRITE              N                    DWH_CODE\t\t\t\trelation is not a partitioned table\n\n18 rows selected.<\/pre>\n<p>Let&#8217;s try to force a complete refresh with <em>atomic_refresh<\/em> set to FALSE in order to check if the &#8220;<em>Delete<\/em>&#8221; operation is replaced by a &#8220;<em>Truncate<\/em>&#8221; operation:<\/p>\n<p>Now we have a &#8220;<em>Truncate<\/em>&#8220;:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">--c = complete refresh\n dbms_mview.refresh('SCORE.'||l_mview||'','C',atomic_refresh=&gt;FALSE);\n<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_T_False.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-39581 size-full\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_T_False.jpg\" alt=\"\" width=\"785\" height=\"111\" \/><\/a><\/p>\n<p>Plus an &#8220;<em>Insert<\/em>&#8221; :<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_I2_False.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-39582 size-large\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_I2_False.png\" alt=\"\" width=\"1024\" height=\"273\" \/><\/a><\/p>\n<p>Let&#8217;s check now the refresh time :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SELECT * \nFROM ( SELECT OWNER, \n\t\t\t  MVIEW_NAME, \n\t\t\t  CONTAINER_NAME, \n\t\t\t  REFRESH_MODE, \n\t\t\t  LAST_REFRESH_TYPE, \n\t\t\t  STALENESS, \n\t\t\t  round((LAST_REFRESH_END_TIME-LAST_REFRESH_DATE)*24*60,2) as REFRESH_TIME_MINS \n\t   FROM ALL_MVIEWS \n\t   WHERE LAST_REFRESH_TYPE IN ('FAST','COMPLETE')\n\t ) \nORDER BY REFRESH_TIME_MINS DESC;\n\nOWNER   MVIEW_NAME                       CONTAINER_NAME                   REFRESH_MODE LAST_REFRESH_TYPE STALENESS           REFRESH_TIME_MINS\n------- -------------------------------- -------------------------------- ------------ ----------------- -------------------------------------\nSCORE   MV$SCORE_ST_SI_MESSAGE           MV$SCORE_ST_SI_MESSAGE           FAST         COMPLETE \t FRESH                            6.75\nSCORE   MV$SCORE_ST_SI_MESSAGE_HISTORY   MV$SCORE_ST_SI_MESSAGE_HISTORY   FAST         COMPLETE \t FRESH                               1\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Conclusion (for my environment) :<\/p>\n<ul>\n<li>The &#8220;<em>Complete<\/em>&#8221; refresh (7.75 mins) is more faster than the &#8220;<em>Fast<\/em>&#8221; refresh (48.9 mins),<\/li>\n<li>The parameter &#8220;<em>atomic_refresh=FALSE<\/em>&#8221; works only with &#8220;<em>complete<\/em>&#8221; refresh, so &#8220;<em>truncate<\/em>&#8221; is only possible with &#8220;<em>complete<\/em>&#8220;.<\/li>\n<li>It&#8217;s not a surprise to have &#8220;<em>Complete<\/em>&#8221; more faster than &#8220;<em>Fast<\/em>&#8221; since the materialized views are truncated instead of being deleted.<\/li>\n<\/ul>\n<p>Now, I want to understand why &#8220;Fast refresh&#8221; is very long (48.9 mins).<\/p>\n<p>In order to be fast refreshed, materialized view requires materialized view logs storing the modifications propagated from the base tables to the container tables (regular table with same name as materialized view which stores the results set returned by the query).<\/p>\n<p>Let&#8217;s check the base tables used into the SQL statement loading the materialized view :<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MVSCORE_ST_SI_MESSAGE_HISTORY.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-39588 size-large\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MVSCORE_ST_SI_MESSAGE_HISTORY.png\" alt=\"\" width=\"1024\" height=\"384\" \/><\/a><\/p>\n<p>Be focus on the table names after the clause &#8220;<em>FROM<\/em>&#8220;:<\/p>\n<ul>\n<li>ST_SI_MESSAGE_HISTORY_H<\/li>\n<li>ST_SI_MESSAGE_HISTORY_V<\/li>\n<li>DWH_CODE<\/li>\n<\/ul>\n<p>Let&#8217;s check the number of rows which exist on each tables sources :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; SELECT 'DWH_CODE' as TABLE_NAME,NUM_ROWS FROM USER_TABLES WHERE TABLE_NAME = 'DWH_CODE'\n  2  UNION ALL\n  3  SELECT 'ST_SI_MESSAGE_HISTORY_H' as TABLE_NAME,NUM_ROWS FROM USER_TABLES WHERE TABLE_NAME = 'ST_SI_MESSAGE_HISTORY_H'\n  4  UNION ALL\n  5  SELECT 'ST_SI_MESSAGE_HISTORY_V' as TABLE_NAME,NUM_ROWS FROM USER_TABLES WHERE TABLE_NAME = 'ST_SI_MESSAGE_HISTORY_V';\n\nTABLE_NAME                NUM_ROWS\n----------------------- ----------\nDWH_CODE                         1\nST_SI_MESSAGE_HISTORY_H    4801733\nST_SI_MESSAGE_HISTORY_V    5081578<\/pre>\n<p>&nbsp;<\/p>\n<p>To be fast refreshed, the MV$SCORE_ST_SI_MESSAGE_HISTORY materialized view requires materialized logs on the ST_SI_MESSAGE_HISTORY_H, ST_SI_MESSAGE_HISTORY_V and DWH_CODE tables:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; SELECT LOG_OWNER,MASTER,LOG_TABLE\n  2  FROM all_mview_logs\n  3  WHERE MASTER IN ('DWH_CODE','ST_SI_MESSAGE_H','ST_SI_MESSAGE_V');\n\nLOG_OWNER   MASTER                 LOG_TABLE\n----------- ------------------ ----------------------------\nSCORE       ST_SI_MESSAGE_V        MLOG$_ST_SI_MESSAGE_V\nSCORE       ST_SI_MESSAGE_H        MLOG$_ST_SI_MESSAGE_H\nSCORE       DWH_CODE               MLOG$_DWH_CODE<\/pre>\n<p>&nbsp;<\/p>\n<p>As, the materialized view logs contains only the modifications during a fast refresh, let&#8217;s check the contents (number of rows modified coming from the base tables) just before to execute the fast-refresh :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; SELECT\n  2              owner,\n  3              mview_name,\n  4              container_name,\n  5              refresh_mode,\n  6              last_refresh_type,\n  7              staleness\n  8          FROM\n  9              all_mviews\n 10          WHERE\n 11              last_refresh_type IN (\n 12                  'FAST',\n 13                  'COMPLETE'\n 14              )\n 15  ;\n\nOWNER   MVIEW_NAME                     CONTAINER_NAME                 REFRESH_MODE LAST_REFRESH_TYPE STALENESS\n------- ------------------------------ ---------------------------------------------------------------------------\nSCORE   MV$SCORE_ST_SI_MESSAGE         MV$SCORE_ST_SI_MESSAGE         DEMAND       COMPLETE          NEEDS_COMPILE\nSCORE   MV$SCORE_ST_SI_MESSAGE_HISTORY MV$SCORE_ST_SI_MESSAGE_HISTORY DEMAND       COMPLETE \t     NEEDS_COMPILE\n<\/pre>\n<p>&nbsp;<\/p>\n<p><em>STALENESS = NEEDS_COMPILE<\/em> means the materialized view need to be refreshed because base tables have been modified. It&#8217;s normal since we have stopped the ETL process just before the execution of the refresh mview procedure in order to see the content of the mview logs.<\/p>\n<p>The contents of materialized view logs are :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; SELECT * FROM \"SCORE\".\"MLOG$_DWH_CODE\";\n\nM_ROW$$               SNAPTIME$ DMLTYPE$$ OLD_NEW$$ CHANGE_VECTOR$$  XID$$\n--------------------- --------- --------- --------- ---------------- ----------------\nAAAbvUAAUAAABtjAAA    01-JAN-00 U \t\t  U \t\t02   1125921382632021\nAAAbvUAAUAAABtjAAA    01-JAN-00 U \t\t  N \t\t02   1125921382632021\n\nSQL&gt; SELECT * FROM \"SCORE\".\"MLOG$_ST_SI_MESSAGE_V\";\n\nno rows selected\n\nSQL&gt; SELECT * FROM \"SCORE\".\"MLOG$_ST_SI_MESSAGE_H\";<\/pre>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">no rows selected \nSQL&gt;<\/pre>\n<p>I&#8217;m a little bit surprised because:<\/p>\n<ul>\n<li>Being given my refresh time, I expected to have a lot of modifications coming from the big tables : ST_SI_MESSAGE_V (5081578 rows) and ST_SI_MESSAGE_H (4801733 rows) instead of DWH_CODE (1 row).<\/li>\n<\/ul>\n<p>After analyzing the ETL process, it appears that only this table (DWH_CODE) is modified every day with the sysdate. This table is a metadata table which contents only one row identifying the loading date.<\/p>\n<p>If we check the SQL statement loading the materialized view, this table is used to populate the column DWH_PIT_DATE (see print screen above).<\/p>\n<p>But since this table is joined with ST_SI_MESSAGE_H and ST_SI_MESSAGE_V, the oracle optimizer must do a full scan on the materialized view MV$SCORE_ST_SI_MESSAGE_HISTORY (more than 500K rows) to populate each row with exactly the same value:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; select distinct dwh_pit_date from score.mv$score_st_si_message_history;\n\nDWH_PIT_DATE\n------------\n09-MAY-20\n\n<\/pre>\n<p>There is no sense to have a column having always the same value, here we have definitely a materialized view design problem.Whatever the refresh mode using : &#8220;Complete&#8221; or &#8220;Fast&#8221;, we always scan all the materialized view logs to populate column DWH_PIT_DATE.<\/p>\n<p>To solve this issue, let&#8217;s check the materialized view logs dependencies :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; SELECT DISTINCT NAME\n  2  FROM ALL_DEPENDENCIES\n  3  WHERE TYPE = 'VIEW'\n  4  AND REFERENCED_OWNER = 'DWH_LOAD'\n  5  AND REFERENCED_NAME IN ('MV$SCORE_ST_SI_MESSAGE','MV$SCORE_ST_SI_MESSAGE_HISTORY')\n  6  ORDER BY NAME;\n\nNAME\n--------------------------------------------------------------------------------\nV$LOAD_CC_DMSG\nV$LOAD_CC_FMSG\nV$LOAD_CC_MSG_ACK\nV$LOAD_CC_MSG_BOOKEDIN_BY\nV$LOAD_CC_MSG_PUSHEDBACK\nV$LOAD_CC_MSG_SCENARIO\nV$LOAD_CC_MSG_SOURCE\nV$LOAD_CC_MSG_SRC\nV$LOAD_CC_MSG_TRIAGED_BY\n\n9 rows selected.\n\nSQL&gt;<\/pre>\n<p>In my environment, only this objects (oracle views) use the materialized views, so I can safely remove the column DWH_CODE.DWH_PIT_DATE (the column not the join with the table DWH_CODE) from the materialized views and move it to the dependent objects.<\/p>\n<p>After this design modifications, let&#8217;s execute the refresh and check the refresh time :<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; SELECT *\n  2  FROM ( SELECT OWNER,\n  3    MVIEW_NAME,\n  4    CONTAINER_NAME,\n  5    REFRESH_MODE,\n  6    REFRESH_METHOD,\n  7    LAST_REFRESH_TYPE,\n  8    STALENESS,\n  9    ROUND((LAST_REFRESH_END_TIME-LAST_REFRESH_DATE)*24*60,2) as REFRESH_TIME_MINS\n 10     FROM ALL_MVIEWS\n 11     WHERE LAST_REFRESH_TYPE IN ('FAST','COMPLETE')\n 12   )\n 13  ORDER BY REFRESH_TIME_MINS DESC;\n\nOWNER     MVIEW_NAME                            CONTAINER_NAME                       REFRES REFRESH_ LAST_REF STALENESS           REFRESH_TIME_MINS\n--------- --------------------------------- ------------------------------------ ------ -------- -------- ------------------- ---------------------\nSCORE     MV$SCORE_ST_SI_MESSAGE                MV$SCORE_ST_SI_MESSAGE               DEMAND FAST     COMPLETE FRESH                            1.58\nSCORE     MV$SCORE_ST_SI_MESSAGE_HISTORY        MV$SCORE_ST_SI_MESSAGE_HISTORY       DEMAND FAST     COMPLETE FRESH                             .28<\/pre>\n<p>&nbsp;<\/p>\n<p>The refresh time is faster (1.86 mins) than the last one (7.75 mins) and now oracle optimizer does not full scan the materialized view to populate each row with same value (DWH_CODE.DWH_PIT_DATE).<\/p>\n<p>Conclusion :<\/p>\n<ul>\n<li>We have reduced the refresh time from 50mins to 1.86 mins.<\/li>\n<li>Fast Refresh is not always more faster than Complete Refresh, it depends of the SQL statement loading the view and the number of rows propagated from the base tables to the container tables within the materialized view logs.<\/li>\n<li>To decrease the refresh time, act only on the refresh option (Fast, Complete, Index,etc.) is not enough, we have to also analyze and modify the SQL statement loading the materialized view.<\/li>\n<li>\u00a0If you have design problem, never be afraid to modify the SQL statement and even some part of your architecture (like here the dependent objects). Of course you have to know very well the impact on your application and on your ETL process.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In contrary of views, materialized views avoid executing the SQL query for every access by storing the result set of the query. When a master table is modified, the related materialized view becomes stale and a refresh is necessary to have the materialized view up to date. I will not show you the materialized view [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":14101,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,59],"tags":[],"type_dbi":[],"class_list":["post-14094","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring","category-oracle"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Oracle Materialized View Refresh : Fast or Complete ? - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Oracle Materialized View Refresh : Fast or Complete ?\" \/>\n<meta property=\"og:description\" content=\"In contrary of views, materialized views avoid executing the SQL query for every access by storing the result set of the query. When a master table is modified, the related materialized view becomes stale and a refresh is necessary to have the materialized view up to date. I will not show you the materialized view [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-10T16:07:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1866\" \/>\n\t<meta property=\"og:image:height\" content=\"648\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"Oracle Materialized View Refresh : Fast or Complete ?\",\"datePublished\":\"2020-05-10T16:07:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/\"},\"wordCount\":1069,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png\",\"articleSection\":[\"Database Administration &amp; Monitoring\",\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/\",\"name\":\"Oracle Materialized View Refresh : Fast or Complete ? - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png\",\"datePublished\":\"2020-05-10T16:07:01+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png\",\"width\":1866,\"height\":648},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Oracle Materialized View Refresh : Fast or Complete ?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"caption\":\"Oracle Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Oracle Materialized View Refresh : Fast or Complete ? - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/","og_locale":"en_US","og_type":"article","og_title":"Oracle Materialized View Refresh : Fast or Complete ?","og_description":"In contrary of views, materialized views avoid executing the SQL query for every access by storing the result set of the query. When a master table is modified, the related materialized view becomes stale and a refresh is necessary to have the materialized view up to date. I will not show you the materialized view [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/","og_site_name":"dbi Blog","article_published_time":"2020-05-10T16:07:01+00:00","og_image":[{"width":1866,"height":648,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png","type":"image\/png"}],"author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"Oracle Materialized View Refresh : Fast or Complete ?","datePublished":"2020-05-10T16:07:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/"},"wordCount":1069,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png","articleSection":["Database Administration &amp; Monitoring","Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/","url":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/","name":"Oracle Materialized View Refresh : Fast or Complete ? - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png","datePublished":"2020-05-10T16:07:01+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/Explain_Plan_Fast_False.png","width":1866,"height":648},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-materialized-view-refresh-fast-or-complete\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Oracle Materialized View Refresh : Fast or Complete ?"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","caption":"Oracle Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=14094"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14094\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/14101"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=14094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=14094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=14094"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=14094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}