Do the database tables in Oracle Cost-based Optimizer need to be updated?

Using Oracle Cost-Based Optimizer, is it important to re-analyze the database tables and indexes periodically to update the statistics?
The answer all depends on how often your data changes and the nature of the data change. If your data changes frequently, you might wish to recalculate statistics. If a table has data that is pretty static, then recalculating statistics would probably not result in any different CBO decisions. The DBMS_STATS package in Oracle 9i includes an option to calculate "stale" statistics or statistics on those objects that have had significant DML changes occur. Oracle 10g takes this a step further. If you let Oracle 10g automatically compute statistics for you, then 10g will only do this for stale statistics.

Sometimes, it is beneficial to lock down your statistics, even if the data changes. The DBMS_STATS package includes

procedures to lock table and index stats. Thorough testing of statistics with your application code can determine if locking stats is beneficial to you. The point is that when you lock your stats, you cannot recalculate them.

This was first published in May 2005

Dig deeper on Oracle database design and architecture



Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: