GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Oracle  >  Database Administration
Go To First  |  Previous Question  |  Next Question 
 Database Administration  |  Question 224 of 225    Print  
Scenarios for rebuilding indexes
What are the different scenarios for rebuilding indexes...


  
Total Answers and Comments: 1 Last Update: August 02, 2008     Asked by: alex.v 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 02, 2008 09:11:03   #1  
chandubtech Member Since: July 2008   Contribution: 2    

RE: Scenarios for rebuilding indexes
Actually you need to rebuild the indexes for 2 main scenarios.
1)deleted entries represents 20% or more of the current entries
2)the index depth is more than 4 levels

Oracle index nodes are not deleted physically when the rows of tables deleted nor the entries are removed from the index.Oracle deletes these index nodes logically and leaves 'dead nodes' in the index tree itself where these deade nodes may be reused if another adjacent entry is required.

how ever when large number of table rows are deleted,there may be chance of deleted leaf nodes will make index fast full scans for a longer period.
Deleted leaf rows:the term deleted leaf rows referred to the number of  index inodes that have been deleted logically by oracle when rows of table deleted.

in oracle you must use these commands;
SQL>analyze index index_name compute statistics;
SQL>analyze index index_name validate structure;

SQL>select  del_lf_rows/decode(lf_rows,0,1lf_rows) from index_stats where name='index_name';

if the query returns more than 20 %.then you may think of rebuilding the indexes.

or in other way :
after you analyze the above 2 statements ,you may think of rebuild the indexes where height is more than three levels
Index height:The number of levels that index would span when massive inserts happened to tables
Gets Per index access:the number of logical i/o 's required when a row with an index is fetched.
also we need to think of rebuild the indexes when gets per index access is more than 5

example when to rebuild the indexes:
SQL>create table temp_stats  as select name,most_repeated_key,distinct_keys,del_lf_rows,height,blk_gets_per_access from index_stats;

SQL>
insert into temp_stats (select name ,most_repeated_key ,distinct_keys ,del_lf_rows ,height ,blks_gets_per_access  from index_stats);

SQL>select distinct name c1,most_repeated_key c2,distinct_keys c3,del_lf_Rows c4,height c5,blks_gets_per_access c6 from temp_stats where height > 3 or del_lf_rows > 10 order by name;

after analyzing the indexes ,if the above query returns any rows then you need to rebuild the indexes.

 

SQL>alter index index_name rebuild tablespace tablespace_name storage (initial new_initial next new_next freelists new_freelist_number )


 

Though the lengthy  but content one




 
Is this answer useful? Yes | No

 Related Questions

 It consists ofone or more data files.one or more control files.two or more redo log files.The Database containsmultiple users/schemasone or more rollback segmentsone or more tablespacesData dictionary 

The primary functional difference between logical and physical standby database setups is that logical standby permits you to add additional objects (tables, indexes, etc) to the database, while physical 
Latest Answer : A physical or logical standby database is a database replica created from a backup of a primary database. A physical standby database is physically identical to the primary database on a block-for-block basis.  It's maintained in managed ...

Virtual Indexes are another undocumented feature used by Oracle. Virtual indexes, as the name suggests are pseudo-indexes that will not behave the same way that normal indexes behave, and are meant for 
View Question | Asked by : David

Latest Answer : And.. It does not store any data value in it unlike normal index do.Queries will not get benefitted. This can be used only for analysis. ...
Read Answers (2) | Asked by : David

Oracle DBA Questionswhat happen when we kill smon,what happen when we kill pmonwhat is fracture block and how to fix itwhat is corrupted block and how to fix itwhat are the oracle threads are going to start ,when we start the databasehow to check index is working properly ,what are the steps to be taken andon what basis we have to decide particular index has to rebuild not all indexeswhat steps to be taken if receive a call that performance has gone down as dba what steps has be takenWhat possible
View Question | Asked by : Ibad
Tags : Backup

How to assign an index tablespace for a database permanently, so that whatever indexes we are creating in the database, should automatically goes to that tablespace i.e. we neednot supply the tablespace 
Latest Answer : There is no such provision in oracle to have default index tablespace. Workaround is- you can have a job which will scan for indexes in other tablespaces and rebuild into desired one. ...

What are the different scenarios for rebuilding indexes... 
Latest Answer : Actually you need to rebuild the indexes for 2 main scenarios.1)deleted entries represents 20% or more of the current entries2)the index depth is more than 4 levelsOracle index nodes are not deleted physically when the rows of tables deleted nor the entries ...
Read Answers (1) | Asked by : alex.v


 Sponsored Links

 
Related Articles

Querying Data with Oracle XQuery

Querying Data with Oracle XQuery Starting with Oracle Database 10g Release 2 you can take advantage of a full featured native XQuery engine integrated with the database With Oracle XQuery you can accomplish various tasks involved in developing PHP Oracle XML applications operating on any kind of dat
 

Using Oracle XML DB Repository

Using Oracle XML DB Repository Another variation on accessing and manipulating XML content stored in Oracle database is provided by Oracle XML DB repository which is an essential component of Oracle XML DB mosgoogle NOTE Oracle XML DB repository also known as XML repository is a hierarchically organ
 

Using XMLType for Handling XML Data in the Database

Using XMLType for Handling XML Data in the Database Being an object type XMLType can not only be used to store XML data in the database but also to operate on that data via its built in methods Regardless of the storage model you choose XMLType provides a set of XML specific methods to operate on XM
 

Using Oracle Database for Storing, Modifying, and Retrieving XML Data

Using Oracle Database for Storing Modifying and Retrieving XML Data With Oracle XML DB you have various XML storage and XML processing options allowing you to achieve the required level of performance and scalability One of the most interesting things about Oracle XML DB is that it allows you to per
 

Performing XSLT Transformations inside the Database

Performing XSLT Transformations inside the Database Now that you have the employees XSL stylesheet stored in the database and the xmlusr schema is permitted to access the hr employees table you can create a script that will instruct the database to build an HTML page based on the data stored in hr e
 

Moving All the XML Processing into the Database

Moving All the XML Processing into the Database In the preceding example the database server performs only a part of the XML processing while the rest is still performed by the PHP engine Specifically the database server generates an employees XML document based on the records from the hr employees
 

Performing XML Processing inside the Database

Performing XML Processing inside the Database When building XML enabled applications on top of Oracle there are many advantages to performing the XML processing inside the database when compared to performing it on the client The key advantages to perform XML processing inside the database are as fo
 

XML Processing in PHP and Oracle Applications

Processing XML in PHP Oracle Applications As mentioned there are two alternatives when it comes to performing XML processing in your PHP Oracle application You can perform any required XML processing using either PHP s XML extensions or PEAR XML packages or Oracle s XML features mosgoogle In the fol
 

PHP Oracle Web Development

PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax The book is written by Yuli Vaseliev a well known author of different web development and programming books PHP Oracle Web Development Data processing Security Caching XML Web Services and Ajax is a good starting b
 

Getting Started with Oracle and ODP.NET

ODP NET Developer’ s Guide by Jagadish Chatarji Pulakhandam Sunitha Paruchuri A practical guide for developers working with the Oracle Data Provider for NET and the Oracle Developer Tools for Visual Studio 2005 Application development with ODP NET Dealing with XML DB using ODP NET Oracle
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape