During MView Refresh, the Hint "HASH_SJ" Prevents MView Indexes from Being Used for Delete Statement and Causing Poor Performance
(Doc ID 1949537.1)
Last updated on SEPTEMBER 20, 2022
Applies to:Oracle Database - Enterprise Edition - Version 184.108.40.206 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Gen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine) - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.
During the Refresh, the recursive DELETE statement is not using the MVIEW INDEXES. Hence, it always accesses the MVIEW with FULL SCAN for deleting the rows.
You may see a statement like below:
/* MV_REFRESH (DEL) */ DELETE FROM <mview> SNA$ WHERE <column_name> IN (SELECT /*+ HASH_SJ */ * FROM (SELECT M_ROW$$ RID$ FROM MLOG$_<primary> MAS$ WHERE SNAPTIME$$ > :B_ST0) AS OF SNAPSHOT(:B_SCN) MAS$)
The above statement uses "HASH_SJ" hint which enables Optimizer to use "MAT_VIEW ACCESS FULL" rather than the Index created for the DELETE.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document