{"id":4361,"date":"2015-02-09T05:56:23","date_gmt":"2015-02-09T04:56:23","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/"},"modified":"2015-02-09T05:56:23","modified_gmt":"2015-02-09T04:56:23","slug":"never-gather-workload-stats-on-exadata","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/","title":{"rendered":"Never gather WORKLOAD stats on Exadata&#8230;"},"content":{"rendered":"<h2>By Franck Pachot<\/h2>\n<p>.<br \/>\nFor Exadata, oracle has introduced an &#8216;EXADATA&#8217; mode which sets a high transfer rate (with IOTFRSPEED as in NOWORKLOAD statistics) and set a MBRC (as in WORKLOAD statistics). Those values are set rather than gathered because all the SmartScan optimization done at storage cell level, which makes the multiblock reads less expensive, is difficult to measure from the database.<br \/>\nHere I will explain what I stated in a <a href=\"https:\/\/www.dbi-services.com\/index.php\/blog\/entry\/when-to-gather-workload-system-statistics\">previous blog<\/a>: <strong>direct-path reads are not counted as multiblock reads for the MBRC system statistic<\/strong>. And direct-path read should be the main i\/o path in Exadata as you probably bought that machine to benefit from SmartScan.<\/p>\n<h3>With direct-path reads<\/h3>\n<p>On a test database that has no activity, I\u2019m creating a 1000 blocks table. My goal is to gather WORKLOAD system statistics during a simple table full scan on that table, and see how it calculates SREADTIM, MREADTIM and MBRC.<\/p>\n<pre><code>SQL&gt; connect demo\/demo\nConnected.\n\nSQL&gt; drop table DEMO;\nTable dropped.\n\nSQL&gt; create table DEMO pctfree 99 as select rpad('x',1000,'x') n from dual connect by level &lt;=1000;\nTable created.\n<\/code><\/pre>\n<p>Then I run a simple select between the calls to \u2018start\u2019 and \u2018stop\u2019 procedures of the dbms_stats WORKLOAD system stats gathering.<\/p>\n<pre><code>SQL&gt; exec dbms_stats.gather_system_stats('start');\nPL\/SQL procedure successfully completed.\n\nSQL&gt; connect demo\/demo\nConnected.\n\nSQL&gt; select count(*) from DEMO;\n\n  COUNT(*)\n----------\n      1000\n\n<\/code><\/pre>\n<p>I check the physical read statistics (this is why have reconnected my session so that I can query v$mystat without doing the delta)<\/p>\n<pre><code>SQL&gt; select name,value from v$mystat join v$statname using(statistic#) where (name like 'phy%' or name like 'cell%') and value&gt;0;\n\nNAME                                                              VALUE\n------------------------------------------------------------ ----------\nphysical read total IO requests                                      22\nphysical read total multi block requests                              7\nphysical read total bytes                                       8306688\ncell physical IO interconnect bytes                             8306688\nphysical reads                                                     1000\nphysical reads direct                                              1000\nphysical read IO requests                                            15\nphysical read bytes                                             8192000\ncell scans                                                            1\ncell blocks processed by cache layer                               1000\ncell blocks processed by txn layer                                 1000\ncell blocks processed by data layer                                1000\ncell physical IO bytes eligible for predicate offload           8192000\ncell physical IO interconnect bytes returned by smart scan       130760\ncell IO uncompressed bytes                                      8192000\n<\/code><\/pre>\n<p>I\u2019ve read 1000 blocks in 15 i\/o calls so I&#8217;m sure it is multiblock reads. All of them (1000 x 8k) was eligible for SmartScan and those 1000 blocks have been processed by the storage cell.<\/p>\n<p>If you wonder why I have only 7 &#8216;physical read total multi block requests&#8217; it&#8217;s because it accounts only the &#8216;full&#8217; multiblock reads &#8211; not those that are limited by extent boundary. See <a href=\"https:\/\/community.oracle.com\/thread\/3651966\">here<\/a> for that analysis.<\/p>\n<p>If you wonder why I have only 22 &#8216;physical read total IO requests&#8217; then I&#8217;ve not the answer. The sql_trace shows only the 15 &#8216;direct path read&#8217;. And dbms_stats counts only the &#8216;physical read IO requests&#8217;. If you have any idea, please comment.<\/p>\n<p>I stop my WORKLOAD statistics gathering:<\/p>\n<pre><code>SQL&gt; exec dbms_stats.gather_system_stats('stop');\nPL\/SQL procedure successfully completed.\n<\/code><\/pre>\n<p>And check the system statistics that have been set:<\/p>\n<pre><code>SQL&gt; select * from sys.aux_stats$;\n\nSNAME           PNAME           PVAL1\n--------------- ---------- ----------\nSYSSTATS_INFO   STATUS\nSYSSTATS_INFO   DSTART\nSYSSTATS_INFO   DSTOP\nSYSSTATS_INFO   FLAGS               1\nSYSSTATS_MAIN   CPUSPEEDNW       2300\nSYSSTATS_MAIN   IOSEEKTIM          10\nSYSSTATS_MAIN   IOTFRSPEED       4096\nSYSSTATS_MAIN   SREADTIM\nSYSSTATS_MAIN   MREADTIM         .151\nSYSSTATS_MAIN   CPUSPEED         2300\nSYSSTATS_MAIN   MBRC\nSYSSTATS_MAIN   MAXTHR\nSYSSTATS_MAIN   SLAVETHR\n<\/code><\/pre>\n<p>I have no SREADTIM which is expected as I&#8217;ve done only multiblock reads. I have a MREADTIM. But I don&#8217;t have the MBRC set.<\/p>\n<h3>With conventional (aka buffered) reads<\/h3>\n<p>Let&#8217;s do the same after disabling serial direct-path reads:<\/p>\n<pre><code>SQL&gt; alter session set \"_serial_direct_read\"=never;\nSession altered.\n<\/code><\/pre>\n<p>I do the same as before, but now my session stats show only conventional reads:<\/p>\n<pre><code>NAME                                                              VALUE\n------------------------------------------------------------ ----------\nphysical read total IO requests                                      44\nphysical read total multi block requests                             28\nphysical read total bytes                                       8192000\ncell physical IO interconnect bytes                             8192000\nphysical reads                                                     1000\nphysical reads cache                                               1000\nphysical read IO requests                                            44\nphysical read bytes                                             8192000\nphysical reads cache prefetch                                       956\n\n<\/code><\/pre>\n<p>and here are the gathered stats:<\/p>\n<pre><code>SNAME           PNAME           PVAL1\n--------------- ---------- ----------\nSYSSTATS_INFO   STATUS\nSYSSTATS_INFO   DSTART\nSYSSTATS_INFO   DSTOP\nSYSSTATS_INFO   FLAGS               1\nSYSSTATS_MAIN   CPUSPEEDNW       2300\nSYSSTATS_MAIN   IOSEEKTIM          10\nSYSSTATS_MAIN   IOTFRSPEED       4096\nSYSSTATS_MAIN   SREADTIM\nSYSSTATS_MAIN   MREADTIM         .028\nSYSSTATS_MAIN   CPUSPEED         2300\nSYSSTATS_MAIN   MBRC               23\nSYSSTATS_MAIN   MAXTHR\nSYSSTATS_MAIN   SLAVETHR\n\n<\/code><\/pre>\n<p>Now the MBRC is set with the gathered value.<\/p>\n<p>This proves that MBRC is set only for conventional multiblock reads. Direct-path reads are not accounted.<\/p>\n<h3>Conclusion<\/h3>\n<p>If you are on Exadata, you probably want to benefit from SmartScan. Then you probably want the CBO to choose FULL TABLE SCAN which will do direct-path reads for large tables (according that they don&#8217;t have a lot of updated buffers in SGA). If you gather WORKLOAD statistics they will set MBRC without accounting for those direct-path reads and it will probably be set lower than the average actual multiblock read (which &#8211; in direct-path reads &#8211; is close the the db_file_multiblock_read &#8211; default or set value).<\/p>\n<p>This is the reason why Oracle introduced the EXADATA mode: it sets the MBRC from the db_file_multiblock_read value.<br \/>\nThey also set the IOTFRSPEED to a high value because gathering MREADTIM will probably get a very low value &#8211; lower than SREADTIM &#8211; thanks to the SmartScan. And CBO ignores values where MREADTIM is less than SREADTIM.<\/p>\n<p>An alternative to EXADATA mode can be setting those values as NOWORKLOAD statistics and keep the db_file_multiblock_read_count set. You will have the same behavior because CBO uses db_file_multiblock_read_count when it is set and there are no MBRC system stats. But the danger is that if someone resets the db_file_multiblock_read_count (and I often advise to keep defaults) then the CBO will use a value of 8 and that will probably increase the cost of full table scans too much.<\/p>\n<p>All formulas are here with a script that shows what is used by the CBO.<\/p>\n<h3>Never say never<\/h3>\n<p>Well, that blog post title is too extreme because:<\/p>\n<blockquote class=\"twitter-tweet\" lang=\"en\"><p><a href=\"https:\/\/twitter.com\/FranckPachot\">@FranckPachot<\/a> <a href=\"https:\/\/twitter.com\/kevinclosson\">@kevinclosson<\/a> <a href=\"https:\/\/twitter.com\/fritshoogland\">@fritshoogland<\/a> <a href=\"https:\/\/twitter.com\/moustafa_dba\">@moustafa_dba<\/a> <a href=\"https:\/\/twitter.com\/JLOracle\">@JLOracle<\/a> never say never \ud83d\ude09<\/p>\n<p>\u2014 Christian Antognini (@ChrisAntognini) <a href=\"https:\/\/twitter.com\/ChrisAntognini\/status\/564406982816587776\">February 8, 2015<\/a><\/p><\/blockquote>\n<p>So I should say:<br \/>\nNever gather WORKLOAD stats on Exadata&#8230; except if your workload is not an Exadata optimized one.<br \/>\nIf you are using Exadata for OLTP, then yes, you can gather WORKLOAD statistics as they probably fit OLTP behaviour. But in any case, <strong>always check the gathered stats and see if they are relevant.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Franck Pachot . For Exadata, oracle has introduced an &#8216;EXADATA&#8217; mode which sets a high transfer rate (with IOTFRSPEED as in NOWORKLOAD statistics) and set a MBRC (as in WORKLOAD statistics). Those values are set rather than gathered because all the SmartScan optimization done at storage cell level, which makes the multiblock reads less [&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":[198,59],"tags":[103,96,67],"type_dbi":[],"class_list":["post-4361","post","type-post","status-publish","format-standard","hentry","category-database-management","category-oracle","tag-exadata","tag-oracle","tag-performance"],"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>Never gather WORKLOAD stats on Exadata... - dbi Blog<\/title>\n<meta name=\"description\" content=\"The reason why oracle has introduced EXADATA statistics &#039;gathering&#039;.\" \/>\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\/never-gather-workload-stats-on-exadata\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Never gather WORKLOAD stats on Exadata...\" \/>\n<meta property=\"og:description\" content=\"The reason why oracle has introduced EXADATA statistics &#039;gathering&#039;.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-02-09T04:56:23+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=\"5 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\/never-gather-workload-stats-on-exadata\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"Never gather WORKLOAD stats on Exadata&#8230;\",\"datePublished\":\"2015-02-09T04:56:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/\"},\"wordCount\":757,\"commentCount\":0,\"keywords\":[\"Exadata\",\"Oracle\",\"Performance\"],\"articleSection\":[\"Database management\",\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/\",\"name\":\"Never gather WORKLOAD stats on Exadata... - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2015-02-09T04:56:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"description\":\"The reason why oracle has introduced EXADATA statistics 'gathering'.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Never gather WORKLOAD stats on Exadata&#8230;\"}]},{\"@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":"Never gather WORKLOAD stats on Exadata... - dbi Blog","description":"The reason why oracle has introduced EXADATA statistics 'gathering'.","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\/never-gather-workload-stats-on-exadata\/","og_locale":"en_US","og_type":"article","og_title":"Never gather WORKLOAD stats on Exadata...","og_description":"The reason why oracle has introduced EXADATA statistics 'gathering'.","og_url":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/","og_site_name":"dbi Blog","article_published_time":"2015-02-09T04:56:23+00:00","author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"Never gather WORKLOAD stats on Exadata&#8230;","datePublished":"2015-02-09T04:56:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/"},"wordCount":757,"commentCount":0,"keywords":["Exadata","Oracle","Performance"],"articleSection":["Database management","Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/","url":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/","name":"Never gather WORKLOAD stats on Exadata... - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2015-02-09T04:56:23+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"description":"The reason why oracle has introduced EXADATA statistics 'gathering'.","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/never-gather-workload-stats-on-exadata\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Never gather WORKLOAD stats on Exadata&#8230;"}]},{"@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\/4361","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=4361"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4361\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=4361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=4361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=4361"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=4361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}