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

monOpenObjectActivity - Handy Stats...

$
0
0

There are a lot of handy MDAs around in ASE.  This one is real fun.  It allows you have a sneak view into the guts of your ASE workload, on per-object resolution.

 

I'd like to share some insights and challenge you to fill the gaps.

 

First, let's take a look at a sample data (15.7 SP134 - trimmed to counters I want to discuss):

 

Index IDObject NameLogical ReadsPhysical ReadsAPF ReadsPages ReadPhys ical WritesPag es Writt enRows Insert edRows Delet edRows Updat edOperationsLock RequestsLock WaitsOpt Select CountUsed CountSNAPID
0TableA4,796,9251,045365,9578,16400000058,24500032
2pk_TableA16,484,09115,498015,4980000043,690,210NULLNULL1,0484,150,50732
3ak2_TableA0000000000NULLNULL0032
4ak3_TableA0000000000NULLNULL0032
5ak4_TableA0000000000NULLNULL0032
6ak1_TableA0000000000NULLNULL5032
7ak5_TableA7,842285,201224000001,189,633NULLNULL282032
8ak6_TableA0000000000NULLNULL0032
9ak7_TableA0000000000NULLNULL0032
10ak8_TableA0000000000NULLNULL40032
11ak9_TableA0000000000NULLNULL0032
12ak10_TableA0000000000NULLNULL0032
13ak11_TableA0000000000NULLNULL0032
0TableA5,700,4291,093365,9578,21200000058,92100033
2pk_TableA18,696,54815,533015,533000001,069,470,126NULLNULL1,0835,054,27233
3ak2_TableA0000000000NULLNULL0033
4ak3_TableA0000000000NULLNULL0033
5ak4_TableA0000000000NULLNULL0033
6ak1_TableA0000000000NULLNULL5033
7ak5_TableA7,842285,201224000001,189,633NULLNULL282033
8ak6_TableA0000000000NULLNULL0033
9ak7_TableA0000000000NULLNULL0033
10ak8_TableA0000000000NULLNULL40033
11ak9_TableA0000000000NULLNULL0033
12ak10_TableA0000000000NULLNULL0033
13ak11_TableA0000000000NULLNULL0033

 

What can we see from these two consecutive snapshots of data?

 

TableA has been:

accessed about 1k times (UsedCount = Total number of DMLs + Scans on the Object).  Here it is probably Scans only, no DML.

access has been done by the optimizer ~50 times exclusively through the table primary key ( OptSelectCount = Object Selected for Plan by Optimizer)

these 1k accesses resulted in close to 1m total operations on the table (Operations = Object Accesses).

it has resulted in LogicalReads only - mostly retrieved through PK, with a small portion descending to data pages level (IxID 2 + 0).

pretty few lock requests (around 800).

 

So far so good.  So good?  Hm.  If the table has been accessed for ~1000 DMLs/SCANs - how can it be that optimizer selected it only 50 times?  Plan reuse for SPs?  Possible.  If the table has been accessed about 1k times, generating about 1k lock requests, what are those 1m operations that run against the table?  I found it confusing...  Any help?

 

What about another table:

 

Index IDObject NameLogical ReadsPhysical ReadsAPF ReadsPages ReadPhys ical WritesPages WrittenRows Insert edRows Delet edRows Upda tedOperationsLock RequestsLock WaitsOpt Select CountUsed CountSNAP ID
0TableB4,665,058120,6910120,697000001143,55400042
2ak9_TableB0000000000NULLNULL0042
3ak1_TableB0000000000NULLNULL0042
4ak2_TableB0000000000NULLNULL0042
5ak3_TableB0000000000NULLNULL0042
6ak4_TableB0000000000NULLNULL0042
7ak7_TableB0000000000NULLNULL2042
8ak5_TableB17,050814,87764000001NULLNULL25142
9ak6_TableB6360270000041NULLNULL882142
10ak8_TableB75019000006NULLNULL3242
11pk_TableB14,134,3956,93106,9310000012,770,294NULLNULL7324,769,01742
0TableB4,860,552125,39886,646145,018000001151,416040043
2ak9_TableB0000000000NULLNULL0043
3ak1_TableB0000000000NULLNULL0043
4ak2_TableB0000000000NULLNULL0043
5ak3_TableB0000000000NULLNULL0043
6ak4_TableB0000000000NULLNULL0043
7ak7_TableB0000000000NULLNULL2043
8ak5_TableB31,51429433,8842,00200000184,874NULLNULL6511043
9ak6_TableB6360270000041NULLNULL882143
10ak8_TableB75019000006NULLNULL3243
11pk_TableB14,448,6119,66309,6630000012,884,606NULLNULL1,5804,873,83543

 

TableB has been:

accessed about 100k times (UsedCount = Total number of DMLs + Scans on the Object).  Here it is probably Scans only, no DML.

access has been done by the optimizer ~1k times through several table keys and possible table scans ( OptSelectCount = Object Selected for Plan by Optimizer)

these 100k accesses resulted in 300 k total operations on the table (Operations = Object Accesses).

it has resulted in LogicalReads & PhysicalReads - retrieved through PK and one of non-clustered indices (AKx), with a small portion descending to data pages level (IxID 8, 11 + 0).

pretty few lock requests (around 8k).


These values are more easy to interpret:

The table has been accessed in read operations, mostly through its indices, but also table scanned (OptSelect>0, indexID=0,APF>0).

Still, Operations vs UsedCount is moot and APFReads vs PagesRead is moot.  Any explanation?


Index IDObject NameLogical ReadsPhysical ReadsAPF ReadsPages ReadPhysical WritesPages WrittenRows InsertedRows DeletedRows UpdatedOperationsLock RequestsLock WaitsOpt Select CountUsed CountSNAP ID
0TableC96,091400402872874460446892124,515038044536
2pk_TableC4,495202252544600445NULLNULL161636
3ak1_TableC3,7082024545446000NULLNULL20036
4ak2_TableC6,3032024242446002,992NULLNULL844036
5ak3_TableC4,5622025050446001,706NULLNULL321636
6ak4_TableC3,6522024646446000NULLNULL2036
0TableC3,364,49160998,29560186,493186,4931,147,9480248,706249,3552,611,593151,18063437
2pk_TableC4,366,69040410,21510,2151,147,95200248,080NULLNULL636237
3ak1_TableC4,673,03040433,99433,9941,147,841000NULLNULL44037
4ak2_TableC4,377,28440414,81414,8141,147,5880037,882NULLNULL1768137
5ak3_TableC4,564,74940415,82815,8281,147,43600391,707NULLNULL1196337
6ak4_TableC3,800,18140413,80613,8061,147,045000NULLNULL10037


TableC has been:

accessed about 200 times by DMLs (update + insert, may be some scans too) (UsedCount = Total number of DMLs + Scans on the Object). 

access has been done by the optimizer ~1k times involving all table keys and table data ( OptSelectCount = Object Selected for Plan by Optimizer)

these DMLs resulted in 1m total operations on the table - distributed across various table keys and data pages (Operations = Object Accesses).

it has resulted in inserts/updates across all of the indices, generated locks and lock contention.

 

Here values are too tempting.  Again, probably some table scans resulting in physical io to get to the table - may be as a part of update dml itself.  DML resulting in each table index being updated.  Operations for the same access (DML) multiplied by the changes to each index (makes sense).  But - OptSelectCount higher than UsedCount?  For SP/LWP call, UsedCount may be higher than OptSelectCount (plan reuse).  When it is vice versa?  1K APF Reads with puny 30 PagesRead?  Confusing again.

 

Now, it is true that the table may be used to get a general idea as to which object is used in what way in your ASE - if there are table scans, physcial read, excessive logical reads.  To create a object heat map for the server, so to say.  But the data in the table on close inspection becomes very confusing.

 

I've done a test (on ASE 16 SP01) to see if going slowly rather than plunging into a busy ASE makes it easier to understand what's going on in this table.

 

Here is the test:

 

TSObjectNameIndexIDUsed CountScansUpdatesInsertsDeletesOperationsRows InsertedRows DeletedRows UpdatedLock RequestsOpt Select CountOperation
12:39:04MDA_TESTS2000000000060create table (pk = unique clustered on a
12:39:04MDA_TESTS2_pk1000000000NULL0NULL
12:39:04MDA_TESTS2_ak2000000000NULL0NULL
12:39:56MDA_TESTS2010000010000100010000020430insert MDA_TESTS2 (b
12:39:56MDA_TESTS2_pk1000001000100000NULL0NULL
12:39:56MDA_TESTS2_ak2000000100000NULL0NULL
12:40:42MDA_TESTS2010000010000100110000020490select count(*) from MDA_TESTS2 -> showplan = Table Scan.
12:40:42MDA_TESTS2_pk1110001001100000NULL1NULL
12:40:42MDA_TESTS2_ak2000000100000NULL0NULL
12:41:49MDA_TESTS2010000010000100210000020540select * from MDA_TESTS2 -> showplan = Table Scan.
12:41:49MDA_TESTS2_pk1220001002100000NULL2NULL
12:41:49MDA_TESTS2_ak2000000100000NULL0NULL
12:43:51MDA_TESTS2010000010000100210000020540NULL
12:43:51MDA_TESTS2_pk1220001002100000NULL2NULL
12:43:51MDA_TESTS2_ak2000000100000NULL0NULL
12:44:39MDA_TESTS2010000010000100210000020540NULL
12:44:39MDA_TESTS2_pk1220001002100000NULL2NULL
12:44:39MDA_TESTS2_ak2000000100000NULL0NULL
12:44:51MDA_TESTS20100101100001004100009923520update MDA_TESTS1 set b = 2 where a< 100 - showplan pk
12:44:51MDA_TESTS2_pk13300010041000099NULL3NULL
12:44:51MDA_TESTS2_ak2000000100000NULL0NULL
12:46:09MDA_TESTS201002021000010051000019824540 update MDA_TESTS2 set c = 3 where b = 2 - showplan ak
12:46:09MDA_TESTS2_pk133000100510000198NULL3NULL
12:46:09MDA_TESTS2_ak2110001100000NULL1NULL
12:48:09MDA_TESTS2010030210001100710001119824770delete MDA_TESTS2 where a between 10 and 20 - showplan pk
12:48:09MDA_TESTS2_pk1440001007100011198NULL4NULL
12:48:09MDA_TESTS2_ak21100011000110NULL1NULL
12:51:50MDA_TESTS20100403100011009100011109952220update MDA_TESTS2 set b = 4 where c = 1 - showplan Table Scan
12:51:50MDA_TESTS2_pk15500010091000111099NULL5NULL
12:51:50MDA_TESTS2_ak21100011000110NULL1NULL
12:56:20MDA_TESTS20100504100011011100011110052270update MDA_TESTS2 set b = 4 where a = 1 - via pk
12:56:20MDA_TESTS2_pk16600010111000111100NULL6NULL
12:56:20MDA_TESTS2_ak21100011000110NULL1NULL
12:57:01MDA_TESTS20100605100011012100011110052290update MDA_TESTS2 set c = 4 where b = 1 - via ak
12:57:01MDA_TESTS2_pk16600010121000111100NULL6NULL
12:57:01MDA_TESTS2_ak22200021000110NULL2NULL
13:19:19MDA_TESTS20100706100011013100011118753180update MDA_TESTS2 set c = 4 where b = 2 - via ak
13:19:19MDA_TESTS2_pk16600010131000111187NULL6NULL
13:19:19MDA_TESTS2_ak23300031000110NULL3NULL
15:00:43MDA_TESTS20100706100011013100011118753180create proc SP_MDA_TESTS2_SELECT @a int
15:00:43MDA_TESTS2_pk16600010131000111187NULL6NULL
15:00:43MDA_TESTS2_ak23300031000110NULL3NULL
15:01:18MDA_TESTS20100706100011015100011118753210 exec SP_MDA_TESTS2_SELECT @a = 10
15:01:18MDA_TESTS2_pk18800010151000111187NULL8NULL
15:01:18MDA_TESTS2_ak24400041000110NULL4NULL
15:02:33MDA_TESTS201008061000210171000811118769480delete MDA_TESTS2 where a > 200
15:02:33MDA_TESTS2_pk199000101710008111187NULL9NULL
15:02:33MDA_TESTS2_ak244000410008110NULL4NULL
15:03:28MDA_TESTS201009071000210191000811118769500SP_MDA_TESTS2_UPDATE @a = 10
15:03:28MDA_TESTS2_pk11010000101910008111187NULL10NULL
15:03:28MDA_TESTS2_ak244000410008110NULL4NULL
15:03:43MDA_TESTS201010081000210211000811118769510SP_MDA_TESTS2_UPDATE @a = 10
15:03:43MDA_TESTS2_pk11111000102110008111187NULL10NULL
15:03:43MDA_TESTS2_ak244000410008110NULL4NULL
15:04:01MDA_TESTS201011091000210231000811118769520SP_MDA_TESTS2_UPDATE @a = 10
15:04:01MDA_TESTS2_pk11212000102310008111187NULL10NULL
15:04:01MDA_TESTS2_ak244000410008110NULL4NULL
15:04:32MDA_TESTS201011091000210261000811118769580SP_MDA_TESTS2_SELECT @a = 10
15:04:32MDA_TESTS2_pk11515000102610008111187NULL10NULL
15:04:32MDA_TESTS2_ak266000610008110NULL4NULL
15:05:11MDA_TESTS201011091000210281000811118769620SP_MDA_TESTS2_SELECT @a = 10
15:05:11MDA_TESTS2_pk11717000102810008111187NULL10NULL
15:05:11MDA_TESTS2_ak277000710008110NULL4NULL
15:05:28MDA_TESTS201011091000210291000811118769640SP_MDA_TESTS2_SELECT @a = 10
15:05:28MDA_TESTS2_pk11818000102910008111187NULL10NULL
15:05:28MDA_TESTS2_ak288000810008110NULL4NULL


I won't walk through all steps, but you may easily see that here (ASE16) too are things that start to confuse:

Operations on PK and DATA seem to be repeated (non found in real life - not  in 15.7)

OptSelectCount stays zero for operations that result in table scan (based on showplan).

Insert operation populating the table which definitely affect all its indices does not change the Operation counter for all.


Did anyone tried to read this table in detail?  How safe-proof are the assumption made base on the data displayed in it?  I wish SAP would produce more documentation on MDAs.  Numbers in it are really cute...


Would appreciate some insights.


Thank you,


Andrew




Viewing all articles
Browse latest Browse all 3587

Trending Articles



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