Oracle Training Oracle Support Development Oracle Apps

Free Oracle Tips

HTML Text

 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle News

 Oracle Forum
 Class Catalog


 Our Staff
 Our Prices
 Help Wanted!

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 UNIX
 Oracle UNIX
 Linux
 Oracle Linux
 Monitoring
 Remote help

 Remote plans
 Remote
services
 Oracle C++
 Oracle Java
 Apache
 JDeveloper
 App Server

 Applications
 Oracle Forms
 Oracle Portal
 11i Upgrades
 SQL Server
 Oracle Concepts
 HTML-DB Tips
 Software Help

 Remote Help  
 Development  

 Implementation


 Financials Training
 Oracle 11i
 Oracle Apps 11i
 Oracle Workflow
 Oracle AR 11i Class
 Oracle AP 11i class
 Oracle GL 11i class
 Oracle HR 11i class
 Oracle FA 11i class
 11i Project Mgt
 11i procurement
 11i collections


 Oracle Posters
 Oracle Books

 Oracle Tuning Book
 Oracle RAC Book
 Oracle Security
 Easy Oracle Books
 Oracle Scripts
 SQL Server DBA
 SQL Design Patterns
 Ion
 Excel-DB   


 BC Oracle News


 Rednecks!
 Dress code
 Arabian Stallion

 Burleson Arabians
 Guide Horses
 Don Burleson Blog
 Golf & Travel


 Privacy Policy
 

 

   

 


The Tune MView Advisor, and improvements to Query Rewrite

Query Rewrite (the ability for Oracle to transparently redirect queries from detail level to summary tables) is one of the best data warehousing features in Oracle 8i and 9i, but it's sometimes a bit temperamental and you can often find that queries don't actually get rewritten. Sometimes this is because you've broken one of the Query Rewrite restrictions, sometimes it's because your materialized view doesn't contain the correct columns and aggregates. Oracle 10g has a number of improvements to Query Rewrite and the materialized view tuning process that should make this process a bit more productive.

With Oracle Database 10g, query rewrite is now possible when your SELECT statement contains analytic functions, full outer joins, and set operations such as UNION, MINUS and INTERSECT. In addition, you can now use a hint, /*+ REWRITE_OR_ERROR */, which will stop the execution of a SQL statement if query rewrite cannot occur.

SQL> SELECT   /*+ REWRITE_OR_ERROR */
  2    		s.prod_id,
  3    		sum(s.quantity_sold)
  4  FROM     	sales s
  5  GROUP BY 	s.prod_id;
FROM     sales s
         *
ERROR at line 4:
ORA-30393: a query block in the statement did not rewrite

Oracle 9i came with two packages, DBMS_MVIEW.EXPLAIN_MVIEW and DBMS_MVIEW.EXPLAIN_REWRITE that could be used to diagnose why a materialized view wasn't being used for query rewrite. However, although these packages told you why rewrite hadn't happened, they left it down to you to work out how to alter your CREATE MATERIALIZED VIEW statement to ensure that rewrite happened correctly. Oracle Database 10g comes with a new advisor package, DBMS_ADVISOR.TUNE_MVIEW, that takes as its input a CREATE MATERIALIZED VIEW DML statement, and outputs a corrected version that supports query rewrite and features such as fast refresh.

More details on Query Rewrite improvements and the Tune MView Adviser can be found in this presentation by Lillian Hobbs (password 'presentation'), the TUNE_MVIEW online documentation, the  Query Rewrite online documents and  this Oracle Database 10g Oracle-by-Example tutorial.


 

 

   
  
 

 Oracle cruise
 
 
 
Oracle performance tuning software
 
 

Oracle performance tuning book

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.
 
 


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

 

Remote DBA Services


 

Copyright © 1996 -  2009 by Burleson Enterprises, Inc. All rights reserved.

Oracle © is the registered trademark of Oracle Corporation.