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 num_rows in dba_tables

Oracle Database Tips by Donald Burleson

One of the most common problems (prior to Oracle 10g) was that Oracle DBA's would accidentally change the execution behavior of their SQL by changing the num_rows for a table.  Sometimes a DBA wants to know the row count, and the data dictionary view dba_tables has a column named num_rows.

However, num_rows was not put there to help the DBA create management reports for his end-user managers!  The num_rows value was created to assist the cost-based SQL optimizer in determining the optimal execution plan for any SQL that accesses the table.  The num_rows column of the dba_tables view can be set with any of these commands:

analyze table FRED;

EXEC DBMS_UTILITY.analyze_schema('OWNER','FRED');

EXEC DBMS_STATS.gather_table_stats('OWNER', 'FRED');

When tuning SQL for a whole database, you can adjust many of the Oracle optimizer parameters, but for tuning an individual SQL statement, there is nothing better than changing the schema statistics.  Small able can appear to be large, and this will give you important clues about how num_rows is used to optimize your query execution.  In this example, we adjust num_rows to one million, making a small table appear large to the Oracle optimizer.  In general a small num_rows will increase the probability that the CBO will choose an index (as opposed to a full-table scan).

exec dbms_stats.set_table_stats(OWNNAME=>'FLINTSTONE', TABNAME=>'FRED',
NUMROWS=>100000000);

I can't emphasize the importance of understand the role of your schema statistics in your SQL performance.  If you like SQL tuning, I have over 100 pages dedicated to Oracle SQL optimizer tuning, and I have some important real-world insights into Oracle tuning.  I also offer ready-to-use Oracle tuning scripts to help you get started fast.  You can get your copy of Oracle Tuning, directly from the publisher at this link below and you can instantly download he Oracle tuning scripts to get started fast:

http://www.dba-oracle.com/bp/s_oracle_tuning_book.htm


 

 

��  
 
 
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.