My Oracle Support Banner

Query Rewrite Does Not Occur (Doc ID 1055753.1)

Last updated on FEBRUARY 19, 2019

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.1 to 11.2.0.2 [Release 10.2 to 11.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Exadata 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.

Symptoms

NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product.  Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

Adding an additional 'WHERE' condition or changing the range of the filter in the
'WHERE' clause prevents query rewrite.

<Bug 9253380> and <Bug 8977684>


from rewrite_table, for the failing query, the violations seen are to of the type :

QSM-01150: query did not rewrite
QSM-01102: materialized view, MV1, requires join back to table,
TABLE1, on column, COLUMNA
QSM-01102: materialized view, MV1, requires join back to table,
TABLEX, on column, COLUMNA
QSM-01102: materialized view, MV1, requires join back to table,
DIM_TIME, on column, COLUMNA
QSM-01102: materialized view, MV1, requires join back to table,
TABLEY, on column, FACT_TYPE
QSM-01102: materialized view, MV1, requires join back to table,
TABLETEST, on column, COLUMNA
QSM-01102: materialized view, MV1, requires join back to table,
TABLETEST, on column, COLUMNB
QSM-01102: materialized view, MV1, requires join back to table,
TABLETEST, on column, COLUMNC
QSM-01082: Joining materialized view, MV1, with table, TABLEX,
not possible
QSM-01102: materialized view, MV1, requires join back to table,
TABLE1, on column, COLC
QSM-01102: materialized view, MV1, requires join back to table,
TABLE1, on column, COLUMND
QSM-01102: materialized view, MV1, requires join back to table,
TABLEX, on column, COLC
QSM-01102: materialized view, MV1, requires join back to table,
TABLEX, on column, COLUMND

Changes

1. An additional 'WHERE' condition in comparison to the mview definition
OR

2. Changing the range of the filter in the 'WHERE' clause in comparison to the mview definition
    E.G.        MV contains the following in the where clause:

WHERE U.TR_DATE BETWEEN
TIMESTAMP '2009-01-01 00:00:00.000000000'
AND TIMESTAMP '2009-09-28 00:00:00.000000000'

When a query is executed using this same text the query is rewritten.
Rewrite does not happen when the text is changed to this:

WHERE U.TR_DATE BETWEEN
TIMESTAMP '2009-01-11 00:00:00.000000000'
AND TIMESTAMP '2009-09-22 00:00:00.000000000'

Cause

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
Symptoms
Changes
Cause
Solution
References

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.