Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Eduardo.

Asked: September 03, 2020 - 7:47 am UTC

Last updated: September 08, 2020 - 1:26 am UTC

Version: 8.1.7

Viewed 1000+ times

You Asked

Hi, I have an urgent question. A script has been scheduled on our database since 2008 which rebuilds and creates the statistics of all indexes. From what I understand, following your thread, this script is not useful. Please, I would need some advice, my idea is to make a script that does the VALIDATE STRUCTURE for all indexes and the tables read from a pilot table. Save the INDEX_STATS record in a support table and then REBUILD the indexes that are extracted with the following query:

SELECT name, height, lf_rows, del_lf_rows, (del_lf_rows/lf_rows)
*100 as ratio FROM temp_index_stats where height>3 or (del_lf_rows/lf_rows)>10

Could this be a good solution?

After the REBUILD is it necessary to create the statistics for the index?

If it is necessary to create the statistics, can I recreate them with DBMS_STATS.GATHER_INDEX_STATS?

Thanks for your help.

and Connor said...

My advice ... just turn off the script and see what happens. The most likely outcome is that everything will be just fine.

You *might* have some need to rebuild indexes, but its pretty rare.

Here's an excellent resource to guide you

https://richardfoote.files.wordpress.com/2007/12/index-internals-rebuilding-the-truth.pdf

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thank you.

A reader, September 04, 2020 - 4:10 pm UTC

in my heart is the answer I was waiting for. The problem will be to make others understand, but I will succeed..
Thank you Connor.
Connor McDonald
September 07, 2020 - 2:22 am UTC

glad we could help

Statistics

A reader, September 07, 2020 - 7:41 am UTC

Just one last question, do I suspend the rebuilding of the indices but can I leave the creation of the statistics scheduled?
Thank you
Connor McDonald
September 08, 2020 - 1:26 am UTC

If you mean the "validate structure" command, then just remember that this might be doing a lot of locking (and resource consumption) in your database.

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database