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

 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
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

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

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







 all_rows vs. first_rows optimization

Oracle Database Tips by Donald BurlesonDecember 29, 2015

Question:  What is the difference between the all_rows and first_rows optimizer modes?  I know that all_rows and first_rows are optimizer goals but I don't understand how the difference can be between the best execution plan for all rows and the best execution plan using first_rows SQL optimization?

Answer:  While that the many subtle differences between all_rows vs. first_rows optimization, and are some well-defined differences in behavior:

There are several definitions of best" when optimizing SQL and that is the correct forbearance between all_rows and first_rows:

  • first_rows:  Oracle generates a SQL plan that returns the first rows as quickly as possible (favors index access).  Unlike all_rows, the first_rows optimization is there to minimize transaction response time, for small transactions in OLTP systems.  In first_rows mode, The Oracle cost-based optimizer will favor an index scan, even if it has a higher overall cost than a full-table scan.

  • all_rows: The difference is that this is the plan that returns the last rows as quickly as possible (favoring parallel full-table scans).  Unlike first_rows optimization, the all_rows goal is to maximize throughput while minimizing resources consumption, That's another big difference:  all_rows may return no rows at all until all of the the rows have been fetched,

The important thing to remember about the difference between all_rows and first_rows optimization of that the default of all_rows is not appropriate for most databases, and that the first_rows optimizer rmode pays an extra I/O cost(the cost of using an index) to get the rows back quickly.


Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.



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.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster