Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


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


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Oracle opt_param SQL hint tips

Oracle Database Tips by Donald Burleson

Staring in Oracle 10g release 2, Oracle introduced the opt_param SQL hint, without documentation.  It appears that the opt_param hint is very similar to the "alter session" method for changing parameters, but it only applies to that specific SQL statement.

Troubleshooting tip!  For testing, you can quickly test the effect of another optimizer parameter value at the query level without using an 'alter session' command, using the new opt_param SQL hint:

select /*+ opt_param('optimizer_mode','first_rows_10') */ col1, col2 . . .

select /*+ opt_param('optimizer_index_cost_adj',20) */ col1, col2 . .

Syntax: opt_param(<parameter_name> [,] <parameter_value>).

Note: The opt_param hint does not work with all Oracle parameters, and it is largely undocumented.  The following parameters work with opt_param, but there many be many more:

  • hash_join_enabled
  • optimizer_dynamic_sampling
  • optimixer_features_enable
  • optimizer_index_caching
  • optimizer_index_cost_adj
  • optimizer_mode
  • optimizer_secure_view_merging
  • star_transformation_enabled

For example, the SQL below turn-off hash_join_enabled (to forced a nested loop, usually), but only for that SQL statement:

select /*+ opt_param('hash_join_enabled','false') */
dept_no,
emp_name,
empno
from
emp e, dept d
where e.ename=d.dname;

The opt_param hint is also useful for testing the effect of global parameters such as optimizer_mode and optimizer_cost_model.

select /*+ opt_param('optimizer_mode','first_rows_10') */

select /*+ opt_param('_optimizer_cost_model','io') */

select /*+ opt_param('optimizer_index_cost_adj',20) */

select /*+ opt_param('optimizer_index_caching',20) */

select /*+ opt_param('optimizer_features_enable','11.2.0.4')*/

 
If you like Oracle tuning, see the book "Oracle Tuning: The Definitive Reference", with almost 800 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get access to the code depot of Oracle tuning scripts.


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

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 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.