Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: Use MDA to list unused indexes

$
0
0

Hi Rob,

 

This is your query indeed ;-). BTW Your website sypron.nl is extremely useful!

 

I am using the version: Adaptive Server Enterprise/15.5/EBF 20632 SMP ESD#5.2/P/Sun_svr4/OS 5.8/asear155/2602/64-bit/FBO/Sun Dec  9 20:57:41 2012

 

We have enough open objects/indexes:

Name                      Num_free    Num_active  Pct_act Max_Used    Reuse_cnt   Instance_Name

------------------------- ----------- ----------- ------- ----------- ----------- ------------------------------

number of open indexes           2114        2886  57.72         3664           0 NULL

number of open objects           7737       12263  61.31        13244           0 NULL

number of open partitions        7114        2886  28.86         3662           0 NULL

 

My objective is to analyze the biggest and most used table of our database. Our application vendor created 10 indexes and I wonder if having so many indexes could affect the performance (as each INSERT will update the 10 indexes). Deleting unused index will definitely improve the performance.

 

-- size of table + indexes:

1> sp_spaceused Serv

name rowtotal  reserved     data        index_size  unused

---- --------- ------------ ----------- ----------- ----------

Serv 225519609 127360520 KB 56875200 KB 64451260 KB 6034060 KB

 

-- indexes 

1> sp_helpindex Serv;

index_name index_keys                                           index_description               index_max_rows_per_page index_fillfactor index_reservepagegap index_created       index_local

---------- ---------------------------------------------------- ------------------------------- ----------------------- ---------------- -------------------- ------------------- ------------

ServInd2    PID, servTypeCd, TID, sortKey, SID, startDtm, units nonclustered                                          0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd3    SID                                                 nonclustered, unique                                  0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd4    fillerNum, fillerAppID                              nonclustered                                          0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd5    PID, placerNum, placerAppID                         nonclustered                                          0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd6    PID, encntrSID                                      nonclustered                                          0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd7    PID, servTypeCd, sortKey, displayFilter2Cd          nonclustered                                          0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd8    PID, SID, TID                                       nonclustered                                          0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd9    PID, parentSID                                      nonclustered                                          0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd10   PID, ordrngSID                                      nonclustered                                          0                0                    0 Jul 16 2011 11:44AM Global Index

ServInd1    PID, servTypeCd, sortKey                            clustered, allow duplicate rows                       0                0                    0 Jul 16 2011 11:44AM Global Index

 

 

The output of the query against MDA tables show the following about this table after 1 day with 'enable monitoring'=1:

 

Database     Table    IndID       name       

------------ -------- ----------- ------------

.....

prod         Serv               4 ServInd4   

prod         Serv               5 ServInd5   

prod         Serv               8 ServInd8   

prod         Serv              10 ServInd10  

prod         Serv              11 ServInd1

.....

 

One the most used stored procedure usually uses the clustered index ServInd1 in its Query Plan (we are using 'compatibility mode'):

 

QUERY PLAN FOR STATEMENT 9 (at line 98).

    STEP 1

        The type of query is INSERT.

  The update mode is direct.

 

  FROM TABLE

  Serv

        Nested iteration.

  Using Clustered Index.

  Index : ServInd1

  Forward Scan.

  Positioning by key.

  Keys are:

    PID ASC

    servTypeCd ASC

  Using I/O Size 16 Kbytes for index leaf pages.

  With LRU Buffer Replacement Strategy for index leaf pages.

  Using I/O Size 16 Kbytes for data pages.

  With LRU Buffer Replacement Strategy for data pages.      

 

the 20130612, I ran a modified version of the MDA query:

 

DBID        ObjectID    IndexID     OptSelectCount LastOptSelectDate   UsedCount   LastUsedDate

----------- ----------- ----------- -------------- ------------------- ----------- -------------------

       prod    Serv           0              0                NULL           0                NULL

       prod    Serv           4              0                NULL           0                NULL

       prod    Serv           5              0                NULL           0                NULL

       prod    Serv           8              0                NULL           0                NULL

       prod    Serv          10              0                NULL           0                NULL

       prod    Serv          11              0                NULL           0                NULL

       prod    Serv           2              2 Apr 24 2013 10:57AM         718 Jun 12 2013  1:54PM

       prod    Serv           7            694 Jun 12 2013  4:04PM        4260 Jun 12 2013  4:04PM

       prod    Serv           6           2000 Mar 27 2013  5:58PM       67439 Jun 12 2013  4:05PM

       prod    Serv           9              2 Mar 27 2013 10:16AM      104564 Jun 12 2013  4:05PM

       prod    Serv           3           7963 Jun 12 2013  8:49AM    11294223 Jun 12 2013  4:05PM

 

 

QUESTION: Is there a limitation of number of indexes per table that MDA tables can monitor?

 

Thanks,

Vincent


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>