Non riesco davvero a spiegare perché , ma ho fatto un'osservazione che può portarti a soluzione alternativa il problema.
Ecco il risultato di explain_mview
per la query del tuo MV
exec dbms_mview.explain_mview(q'[select A.y, B.z from A join B on A.x = B.x]');
SELECT capability_name, possible, SUBSTR(related_text,1,8)
AS rel_text, SUBSTR(msgtxt,1,60) AS msgtxt
FROM MV_CAPABILITIES_TABLE
WHERE capability_name like '%REWRITE%'
ORDER BY seq;
CAPABILITY_NAME P REL_TEXT MSGTXT
------------------------------ - -------- ------------------------------------------------------------
REWRITE Y
REWRITE_FULL_TEXT_MATCH Y
REWRITE_PARTIAL_TEXT_MATCH Y
REWRITE_GENERAL N the reason why the capability is disabled has escaped analys
REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
Il problema è IMO nel REWRITE_GENERAL = 'N'
Se ripeti lo stesso explain_mview
solo usando POJO
(=semplice vecchio join in Oracle) vedrai un risultato diverso.
truncate table mv_capabilities_table;
exec dbms_mview.explain_mview(q'[select A.y, B.z from A, B where A.x = B.x]');
CAPABILITY_NAME P REL_TEXT MSGTXT
------------------------------ - -------- ------------------------------------------------------------
REWRITE Y
REWRITE_FULL_TEXT_MATCH Y
REWRITE_PARTIAL_TEXT_MATCH Y
REWRITE_GENERAL Y
REWRITE_PCT N general rewrite is not possible or PCT is not possible on an
PCT_TABLE_REWRITE N A relation is not a partitioned table
PCT_TABLE_REWRITE N B relation is not a partitioned table
Ancora importante `REWRITE_GENERAL ='Y'.
Nota che sto usando 18.4 XE e questo è molto sospetto e dovrebbe essere chiarito con Oracle Support.
Le buone notizie finali cioè, se si definisce il MV
con l'Partecipa a Oracle , puoi usare il join ASNI e vedrai la riscrittura:
Esempio
create materialized view MV2
enable query rewrite
as
select
A.y, B.z from A, B where A.x = B.x
EXPLAIN PLAN SET STATEMENT_ID = 'jara1' into plan_table FOR
select A.y, B.z from A join B on A.x = B.x where y = 'A' and z = 'Z'
;
SELECT * FROM table(DBMS_XPLAN.DISPLAY('plan_table', 'jara1','ALL'));
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 3846 | 15384 | 456 (8)| 00:00:01 |
|* 1 | MAT_VIEW REWRITE ACCESS FULL| MV2 | 3846 | 15384 | 456 (8)| 00:00:01 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("MV2"."Z"='Z' AND "MV2"."Y"='A')