Skip to Main Content
  • Questions
  • What is the overhead associated with monitoring indexes?

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, David.

Asked: March 13, 2005 - 12:43 pm UTC

Last updated: February 08, 2006 - 1:29 am UTC

Version: 9.2.0

Viewed 10K+ times! This question is

You Asked

Tom,

I would like to monitor indexes to determine if they're needed. We have a lot of indexes defined by our application (SAP - over 20,000 indexes). I'm wondering what the overhead is associated with this monitoring? eg: alter index <index_name> monitoring usage.

Thanks much for your site!

Regards,
David.

and Tom said...

well, the initial hit is the invalidate of the query plans that will take place (all plans that reference the table the index is on will be invalidated).

After that, it is a nominal hit on the first hard parse -- and nothing after that.

Rating

  (4 ratings)

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

Comments

during monitoring there will be no performance overhaed ?

shameem Ahmed, March 13, 2005 - 11:25 pm UTC

Tom You mean except invalidation of dependent objects there will be no further overhead like performance degradtion .Please can u further clarify it.
Thanx and Regards
Shameem

Tom Kyte
March 14, 2005 - 7:44 am UTC

"u" still isn't showing up for work for whatever reason. Since "u" isn't around, is it OK if I answer?


When you alter the index monitoring, it'll cause an initial hard parse of queries against the table the index is on. After that, there won't be any measurable penalty.

Index monitoring and partitioned indexes

Ebrahim, October 20, 2005 - 11:08 am UTC

Tom,
I tried to use index monitoring on partitioned indexes but the v$object_usage view does not give me any rows:
In the example below ad_region_idx is a partitioned index on asset_detail_tbl (which ofcourse is partitioned).

SQL> select * from v$object_usage;                          
                                                            
no rows selected                                            
                                                            
SQL> alter index idw1.ad_region_idx monitoring usage;       
                                                            
Index altered.                                              
                                          
SQL> select distinct region from idw1.asset_detail_tbl;                   
                                                            
REGION   
-------------------------                           
APAC                                                        
JAPAN                                                    
SQL> set autot traceonly exp                                              
SQL> /                                                      
Execution Plan                                                            
----------------------------------------------------------                
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=3249 Card=1963200 By    
          tes=27484800)                                                   
                                                                          
   1    0   PARTITION LIST (ALL)                                          
   2    1     SORT (UNIQUE) (Cost=3249 Card=1963200 Bytes=27484800)       
   3    2       PARTITION RANGE (ALL)                                     
   4    3         BITMAP INDEX (FAST FULL SCAN) OF 'AD_REGION_IDX'        
SQL> set autot off  
SQL>  select * from v$object_usage;       
no rows selected 

What am I missing? 
Thanks for your help 

Tom Kyte
October 20, 2005 - 4:42 pm UTC

what is missing is the test case...

(you are logged in as the owner of the index right??)

ops$tkyte@ORA9IR2> CREATE TABLE t
  2  (
  3    dt  date,
  4    x   int,
  5    y   varchar2(25)
  6  )
  7  PARTITION BY RANGE (dt)
  8  (
  9    PARTITION part1 VALUES LESS THAN (to_date('13-mar-2003','dd-mon-yyyy')) ,
 10    PARTITION part2 VALUES LESS THAN (to_date('14-mar-2003','dd-mon-yyyy')) ,
 11    PARTITION junk VALUES LESS THAN (MAXVALUE)
 12  )
 13  /

Table created.

ops$tkyte@ORA9IR2> create bitmap index t_idx on t(x) local;

Index created.

ops$tkyte@ORA9IR2> insert into t select to_date( '13-mar-2003', 'dd-mon-yyyy')+mod(rownum,3), rownum, 'x' from all_objects;

30687 rows created.

ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> alter index t_idx monitoring usage;

Index altered.

ops$tkyte@ORA9IR2> set autotrace on explain
ops$tkyte@ORA9IR2> select /*+ index( t t_idx ) */ y from t where x = 42;

Y
-------------------------
x


Execution Plan
----------------------------------------------------------
   0
SELECT STATEMENT Optimizer=CHOOSE (Cost=16 Card=71 Bytes=1917)


   1    0
  PARTITION RANGE (ALL)


   2    1
    TABLE ACCESS (BY LOCAL INDEX ROWID) OF 'T' (Cost=16 Card=71 Bytes=1917)


   3    2
      BITMAP CONVERSION (TO ROWIDS)


   4    3
        BITMAP INDEX (SINGLE VALUE) OF 'T_IDX'





ops$tkyte@ORA9IR2> set autotrace off
ops$tkyte@ORA9IR2> select * from v$object_usage;

INDEX_NAME                     TABLE_NAME                     MON USE
------------------------------ ------------------------------ --- ---
START_MONITORING    END_MONITORING
------------------- -------------------
T_IDX                          T                              YES YES
10/20/2005 16:35:56
 

Thank you

Ebrahim, November 02, 2005 - 11:54 am UTC

I was not logged in as the owner of the index. That was the problem. It is bit unusual that an oracle user with DBA role can not see this info but there must be a good reason for this.
Thank you.

Index Monitoring

Sujith Wimalasooriya, February 07, 2006 - 11:43 am UTC

Hi Tom,

I hope I am putting this question to a appropiate thread.

Once you start monitoring an index, you only going to see if it was used or not in v$object_usage. Is there a way, that you can find out the exact sql statements that used the index, provided that we have not re-started the Database during the period we monitor the index??

Thanks,

Kandy_Train

Tom Kyte
February 08, 2006 - 1:29 am UTC

you may query v$sql_plan - any query that used it would reference it in the plan.

it would only show you queries that are STILL in the shared pool, there could be many that use it, but do not exist right now in your shared pool of course

and you need not be monitoring to do this.