Using the MView "enable query rewrite"

CREATE TABLE TEST_DATE(COL1 VARCHAR2(20),COL2 NUMBER,COL3_DATE DATE,COL4_DATE DATE)
/   

create materialized view TEST_SYS
REFRESH FORCE ON DEMAND
ENABLE QUERY REWRITE  --- ????
AS
SELECT COL1,COL2
FROM    TEST_date
WHERE TRUNC(SYSDATE) BETWEEN TRUNC(COL3_DATE) AND TRUNC(COL4_DATE)
/

If the Enable Query Rewrite option is disabled, the MView is created for the above query, then what is the purpose of including the ENABLE QUERY REWRITE clause when creating a materialized view, can it be deleted and created, and we must compromise the MView performance if we want to comment on Enable Query Rewrite .

Please explain to me how to enable the request overwrite option.

+3
source share
2 answers

Oracle ( TEST_DATE) ( TEST_SYS). , , , .

CREATE MATERIALIZED VIEW mv_transaction_daily
  REFRESH FORCE ON DEMAND
  ENABLE QUERY REWRITE
AS
SELECT store_id,
       transaction_day,
       SUM(transaction_amount) total_transaction_amount
  FROM transactions
 GROUP BY store_id, transaction_day

Oracle ,

SELECT store_id,
       transaction_day,
       SUM(transaction_amount) total_transaction_amount
  FROM transactions
 GROUP BY store_id, transaction_day

, . , ,

SELECT store_id,
       trunc(transaction_day,'MM'),
       SUM(transaction_amount) monthly_transaction_amount
  FROM transactions
 GROUP BY store_id, trunc(transaction_day,'MM')

, , .

, , , . .

SYSDATE WHERE , Oracle , TEST_DATE . Oracle , , , , , , , , SYSDATE .

+7

. , mview, , , .

0

Source: https://habr.com/ru/post/1777674/


All Articles