{"id":4066,"date":"2014-10-15T05:13:08","date_gmt":"2014-10-15T03:13:08","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/"},"modified":"2014-10-15T05:13:08","modified_gmt":"2014-10-15T03:13:08","slug":"oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/","title":{"rendered":"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas"},"content":{"rendered":"<h2>By Franck Pachot<\/h2>\n<p>.<br \/>\nSystem statistics can be gathered in NOWORKLOAD or WORKLOAD mode. Different values will be set depending on that and the others will be calculated &#8211; derived from them. We can see defined values from SYS.AUX_STATS$ but here is a script that shows the calculated ones as well.<\/p>\n<p>With no system statistics or NOWORKLOAD the values of IOSEEKTIM (latency in ms) and IOTFRSPEED (transfer in bytes\/ms) are set and the SREADTIM (time to read 1 block in ms) and MREADTIM (for multiblock read) are calculated from them. MBRC depends on the defaults or the db_file_multiblock_read_count settings.<\/p>\n<p>With WORKLOAD statistics, the SREADTIM and MREADTIM as well as MBRC are measured and those are the ones that are used by the optimizer.<\/p>\n<p>Here is my script:<\/p>\n<pre><code>set echo off\nset linesize 200 pagesize 1000\ncolumn pname format a30\ncolumn sname format a20\ncolumn pval2 format a20\nselect pname,pval2 from sys.aux_stats$ where sname='SYSSTATS_INFO';\nselect pname,pval1,calculated,formula from sys.aux_stats$ where sname='SYSSTATS_MAIN'\nmodel\n  reference sga on (\n    select name,value from v$sga \n        ) dimension by (name) measures(value)\n  reference parameter on (\n    select name,decode(type,3,to_number(value)) value from v$parameter where name='db_file_multiblock_read_count' and ismodified!='FALSE'\n    union all\n    select name,decode(type,3,to_number(value)) value from v$parameter where name='sessions'\n    union all\n    select name,decode(type,3,to_number(value)) value from v$parameter where name='db_block_size'\n        ) dimension by (name) measures(value)\npartition by (sname) dimension by (pname) measures (pval1,pval2,cast(null as number) as calculated,cast(null as varchar2(60)) as formula) rules(\n  calculated['MBRC']=coalesce(pval1['MBRC'],parameter.value['db_file_multiblock_read_count'],parameter.value['_db_file_optimizer_read_count'],8),\n  calculated['MREADTIM']=coalesce(pval1['MREADTIM'],pval1['IOSEEKTIM'] + (parameter.value['db_block_size'] * calculated['MBRC'] ) \/ pval1['IOTFRSPEED']),\n  calculated['SREADTIM']=coalesce(pval1['SREADTIM'],pval1['IOSEEKTIM'] + parameter.value['db_block_size'] \/ pval1['IOTFRSPEED']),\n  calculated['   multi block Cost per block']=round(1\/calculated['MBRC']*calculated['MREADTIM']\/calculated['SREADTIM'],4),\n  calculated['   single block Cost per block']=1,\n  formula['MBRC']=case when pval1['MBRC'] is not null then 'MBRC' when parameter.value['db_file_multiblock_read_count'] is not null then 'db_file_multiblock_read_count' when parameter.value['_db_file_optimizer_read_count'] is not null then '_db_file_optimizer_read_count' else '= _db_file_optimizer_read_count' end,\n  formula['MREADTIM']=case when pval1['MREADTIM'] is null then '= IOSEEKTIM + db_block_size * MBRC \/ IOTFRSPEED' end,\n  formula['SREADTIM']=case when pval1['SREADTIM'] is null then '= IOSEEKTIM + db_block_size        \/ IOTFRSPEED' end,\n  formula['   multi block Cost per block']='= 1\/MBRC * MREADTIM\/SREADTIM',\n  formula['   single block Cost per block']='by definition',\n  calculated['   maximum mbrc']=sga.value['Database Buffers']\/(parameter.value['db_block_size']*parameter.value['sessions']),\n  formula['   maximum mbrc']='= buffer cache size in blocks \/ sessions'\n);\nset echo on<\/code><\/pre>\n<p>Here is an exemple with <strong>default statistics<\/strong>:<\/p>\n<pre><code>PNAME                               PVAL1 CALCULATED FORMULA\n------------------------------ ---------- ---------- --------------------------------------------------\nCPUSPEEDNW                           1519\nIOSEEKTIM                              10\nIOTFRSPEED                           4096\nSREADTIM                                          12 = IOSEEKTIM + db_block_size        \/ IOTFRSPEED\nMREADTIM                                          26 = IOSEEKTIM + db_block_size * MBRC \/ IOTFRSPEED\nCPUSPEED\nMBRC                                               8 = _db_file_optimizer_read_count\nMAXTHR\nSLAVETHR\n   maximum mbrc                           117.152542 = buffer cache size in blocks \/ sessions\n   single block Cost per block                     1 by definition\n   multi block Cost per block                  .2708 = 1\/MBRC * MREADTIM\/SREADTIM\n<\/code><\/pre>\n<p>You see the calculated values for everything. Note the &#8216;maximum mbrc&#8217; which limits the multiblock reads when the buffer cache is small. It divides the buffer cache size (at startup &#8211; can depend on ASMM and AMM settings) by the sessions parameter.<\/p>\n<p>Here is an example with <strong>workload system statistics<\/strong> gathering:<\/p>\n<pre><code>PNAME                               PVAL1 CALCULATED FORMULA\n------------------------------ ---------- ---------- --------------------------------------------------\nCPUSPEEDNW                           1511\nIOSEEKTIM                              15\nIOTFRSPEED                           4096\nSREADTIM                            1.178      1.178\nMREADTIM                              .03        .03\nCPUSPEED                             3004\nMBRC                                    8          8 MBRC\nMAXTHR                            6861824\nSLAVETHR\n   maximum mbrc                           114.983051 = buffer cache size in blocks \/ sessions\n   single block Cost per block                     1 by definition\n   multi block Cost per block                  .0032 = 1\/MBRC * MREADTIM\/SREADTIM\n<\/code><\/pre>\n<p>here all values are explicitly set (added after comment from Raul: those are probably completely wrong as MREADTIM should be &gt; SREADTIM)<\/p>\n<p>And an example with <strong>exadata system statistics<\/strong> that defines noworkload values and sets also the MBRC (see <a href=\"http:\/\/antognini.ch\/2013\/10\/system-statistics-gathered-in-exadata-mode-when-are-they-relevant\/#trackback\">Chris Antognini post<\/a> about it)<\/p>\n<pre><code>PNAME                               PVAL1 CALCULATED FORMULA\n------------------------------ ---------- ---------- --------------------------------------------------\nCPUSPEEDNW                           1539\nIOSEEKTIM                              16\nIOTFRSPEED                         204800\nSREADTIM                                       16.04 = IOSEEKTIM + db_block_size        \/ IOTFRSPEED\nMREADTIM                                       18.28 = IOSEEKTIM + db_block_size * MBRC \/ IOTFRSPEED\nCPUSPEED\nMBRC                                   57         57 MBRC\nMAXTHR\nSLAVETHR\n   maximum mbrc                           114.983051 = buffer cache size in blocks \/ sessions\n   single block Cost per block                     1 by definition\n   multi block Cost per block                    .02 = 1\/MBRC * MREADTIM\/SREADTIM\n<\/code><\/pre>\n<p>And finally here is a <strong>workload system statistics <\/strong>result but with explicitly setting the db_file_multiblock_read_count to 128:<\/p>\n<pre><code>PNAME                               PVAL1 CALCULATED FORMULA\n------------------------------ ---------- ---------- --------------------------------------------------\nCPUSPEEDNW                           1539\nIOSEEKTIM                              15\nIOTFRSPEED                           4096\nSREADTIM                                          17 = IOSEEKTIM + db_block_size        \/ IOTFRSPEED\nMREADTIM                                         271 = IOSEEKTIM + db_block_size * MBRC \/ IOTFRSPEED\nCPUSPEED\nMBRC                                             128 db_file_multiblock_read_count\nMAXTHR\nSLAVETHR\n   maximum mbrc                           114.983051 = buffer cache size in blocks \/ sessions\n   single block Cost per block                     1 by definition\n   multi block Cost per block                  .1245 = 1\/MBRC * MREADTIM\/SREADTIM\n<\/code><\/pre>\n<p>Here you see that the MBRC in noworkload is coming from the value which is set by the db_file_multiblock_read_count rather from the value 8 which is used by default by the optimizer when it is not set. And the MREADTIM is calculated from that i\/o size<\/p>\n<p>For more historical information about system statistics and how multiblock reads are costed (index vs. full table scan choice) see my article on latest <a href=\"http:\/\/viewer.zmags.com\/publication\/a8a4c4aa#\/a8a4c4aa\/62#54\">OracleScene<\/a><\/p>\n<p>As usual, if you find anything to improve in that script, please share.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Franck Pachot . System statistics can be gathered in NOWORKLOAD or WORKLOAD mode. Different values will be set depending on that and the others will be calculated &#8211; derived from them. We can see defined values from SYS.AUX_STATS$ but here is a script that shows the calculated ones as well. With no system statistics [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[59],"tags":[502,349,96,20],"type_dbi":[],"class_list":["post-4066","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-aux_stats","tag-optimizer","tag-oracle","tag-system-statistics"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Oracle system statistics: Display AUX_STATS$ with calculated values and formulas - dbi Blog<\/title>\n<meta name=\"description\" content=\"Script to enhance the display of SYS.AUX_STATS$ with calculated values and formulas\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas\" \/>\n<meta property=\"og:description\" content=\"Script to enhance the display of SYS.AUX_STATS$ with calculated values and formulas\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-15T03:13:08+00:00\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas\",\"datePublished\":\"2014-10-15T03:13:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/\"},\"wordCount\":353,\"commentCount\":0,\"keywords\":[\"aux_stats$\",\"Optimizer\",\"Oracle\",\"System statistics\"],\"articleSection\":[\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/\",\"name\":\"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2014-10-15T03:13:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"description\":\"Script to enhance the display of SYS.AUX_STATS$ with calculated values and formulas\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"caption\":\"Oracle Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas - dbi Blog","description":"Script to enhance the display of SYS.AUX_STATS$ with calculated values and formulas","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/","og_locale":"en_US","og_type":"article","og_title":"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas","og_description":"Script to enhance the display of SYS.AUX_STATS$ with calculated values and formulas","og_url":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/","og_site_name":"dbi Blog","article_published_time":"2014-10-15T03:13:08+00:00","author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas","datePublished":"2014-10-15T03:13:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/"},"wordCount":353,"commentCount":0,"keywords":["aux_stats$","Optimizer","Oracle","System statistics"],"articleSection":["Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/","url":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/","name":"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2014-10-15T03:13:08+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"description":"Script to enhance the display of SYS.AUX_STATS$ with calculated values and formulas","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-system-statistics-display-auxstats-with-calculated-values-and-formulas\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Oracle system statistics: Display AUX_STATS$ with calculated values and formulas"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","caption":"Oracle Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=4066"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4066\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=4066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=4066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=4066"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=4066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}