0% found this document useful (0 votes)
40 views5 pages

Chapter 9, "SQL Queries and Subqueries" Materialized Views Query Rewrite Explain Plan

The document discusses using SELECT statements to retrieve data from tables, views, and materialized views. It explains that Oracle Database may use existing materialized views in place of tables specified in a SELECT statement through a process called query rewrite if certain conditions are met. It provides links to additional documentation on materialized views, query rewrite, and the EXPLAIN PLAN statement used to determine if query rewrite occurred.

Uploaded by

prashaanth55
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views5 pages

Chapter 9, "SQL Queries and Subqueries" Materialized Views Query Rewrite Explain Plan

The document discusses using SELECT statements to retrieve data from tables, views, and materialized views. It explains that Oracle Database may use existing materialized views in place of tables specified in a SELECT statement through a process called query rewrite if certain conditions are met. It provides links to additional documentation on materialized views, query rewrite, and the EXPLAIN PLAN statement used to determine if query rewrite occurred.

Uploaded by

prashaanth55
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Purpose

Use a SELECT statement or subquery to retrieve data from one or more tables, object tables,
views, object views, or materialized views.

If part or all of the result of a SELECT statement is equivalent to an existing materialized view,
then Oracle Database may use the materialized view in place of one or more tables specified in
the SELECT statement. This substitution is called query rewrite. It takes place only if cost
optimization is enabled and the QUERY_REWRITE_ENABLED parameter is set to TRUE. To determine
whether query write has occurred, use the EXPLAIN PLAN statement.

See Also:

 Chapter 9, "SQL Queries and Subqueries" for general information on queries and
subqueries
 Oracle Database Data Warehousing Guide for more information on materialized views
and query rewrite
 EXPLAIN PLAN

Additional Topics

 Prerequisites
 Syntax
 Semantics
 Examples

Prerequisites

For you to select data from a table or materialized view, the table or materialized view must be in
your own schema or you must have the SELECT privilege on the table or materialized view.

For you to select rows from the base tables of a view:

 You must have the SELECT privilege on the view, and


 Whoever owns the schema containing the view must have the SELECT privilege on the
base tables.

The SELECT ANY TABLE system privilege also allows you to select data from any table or any
materialized view or the base table of any view.

To issue an Oracle Flashback Query using the flashback_query_clause, you must have the
SELECT privilege on the objects in the select list. In addition, either you must have FLASHBACK
object privilege on the objects in the select list, or you must have FLASHBACK ANY TABLE system
privilege.
Syntax

select::=

Description of the illustration select.gif

(subquery_factoring_clause ::=, for_update_clause ::=)

subquery::=

Description of the illustration subquery.gif

(query_block::=, order_by_clause ::=)

query_block::=
Description of the illustration query_block.gif

(select_list::=, table_reference::=, join_clause ::=, where_clause::=,


hierarchical_query_clause ::=, group_by_clause ::=, model_clause ::=)

subquery_factoring_clause ::=

Description of the illustration subquery_factoring_clause.gif

select_list::=
Description of the illustration select_list.gif

table_reference::=

Description of the illustration table_reference.gif

(query_table_expression::=, flashback_query_clause ::=, pivot_clause::=, unpivot_clause::=)

flashback_query_clause ::=

Description of the illustration flashback_query_clause.gif

query_table_expression::=
Description of the illustration query_table_expression.gif

(subquery_restriction_clause::=, table_collection_expression ::=)

pivot_clause::=

Description of the illustration pivot_clause.gif

You might also like