Ask the Expert

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?

    Requires Free Membership to View

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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: