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 MAY 12, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.2 and later
Information in this document applies to any platform.

Symptoms

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$_<master> 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.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms