Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • findx.sql /* Find Indexes on specified USER.TABLE_NAME */ Oracle
  • To seee semaphores and shared memory segments in Solaris Linux/Unix
  • Good Site for Oracle Internals Oracle
  • When error comes for temporary tablespace with version <= 9i Oracle
  • Read CSV File using Python Python/PySpark
  • Oracle 10g Wait Model Oracle
  • How To Limit The Access To The Database So That Only One User Per Schema Are Connected (One Concurrent User Per Schema) Oracle
  • Remove duplicate rows from table Oracle
  • Implementing Listener Security Oracle
  • Reclaim temp tablespace for oracle 8, 8i Oracle
  • Adding a new disk and mount it automatically. on VMWARE LINUX Linux/Unix
  • fkwoind.sql fkwoindex.sql Oracle
  • USER_TABLES.Freelists Oracle
  • Important Script Method for tuning Oracle
  • cif crons Linux/Unix

When to rebuld B-tree index

Posted on 09-Feb-2007 By Admin No Comments on When to rebuld B-tree index

Here is the syntax:

analyze index CUSTOMER_LASTNAME_IND validate structure;

It populates the SYS.INDEX_STATS view only. The SYS.INDEX_STATS view can be accessed with the public synonym INDEX_STATS. The INDEX_STATS view will hold information for one index at a time: it will never contain more than one row. Therefore you need to query this view before you analyze next index.

Let’s look at the data inside INDEX_STATS:

select name as IndexName,

height,

lf_rows,

del_lf_rows

from index_stats;

Here are the results of that query:

INDEXNAME HEIGHT LF_ROWS DEL_LF_ROWS

————————- ———- ———- —————

CUSTOMER_LASTNAME_IND 2 5237 2130

The following INDEX_STATS columns are especially useful:

height refers to the maximum number of levels encountered within the index.

lf_rows refers to the total number of leafs nodes in the index.

del_lf_rows refers to the number of leaf rows that have been marked deleted as a result of table DELETEs.

The second rule is that the deleted leaf rows amount (del_lf_rows) should be less than 20 percent of total number of leaf rows (lf_rows). A high number of deleted leaf rows shows that the table has been subjected to heavy DELETE activity. As a result, the index tree becomes unbalanced and the index is a good candidate for rebuilding.

In this example, del_lf_rows equals 2130, lf_rows equals 5237; the ratio is:

(2130*100) / 5237 = 40.7 percent

This index is simply “begging” for rebuilding!

Oracle, SQL scripts

Post navigation

Previous Post: Another export with Query
Next Post: good note for shared pool tunnig

Related Posts

  • dbinv.sql Oracle
  • oracle fast start failover best practice Oracle
  • db_status.sql Oracle
  • Composite Index creation tip from Vivek Oracle
  • online_bkup.sql Oracle
  • Privileges Required to Create Procedures and Functions that uses objects from other schema. Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Find Multiple levels of object dependencies : depen.sql Oracle
  • Oracle Support Metalink ID 161818.1 Oracle
  • Set Role explaination. Oracle
  • Absolute file number and relative file number Oracle
  • Looping for remote servers and find its database from oratab file. Linux/Unix
  • compile_inv.sql Oracle
  • Find Time Consuming SQL Statements in Oracle 10g Oracle
  • Oracle Connections expire_time and firewall Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme