{"id":1714,"date":"2014-01-29T12:00:00","date_gmt":"2014-01-29T12:00:00","guid":{"rendered":"http:\/\/orcldoug.com\/blog\/?p=1714"},"modified":"2014-01-29T12:00:00","modified_gmt":"2014-01-29T12:00:00","slug":"recurring-conversations-incremental-statistics-part-1","status":"publish","type":"post","link":"http:\/\/orcldoug.com\/blog\/2014\/01\/29\/recurring-conversations-incremental-statistics-part-1\/","title":{"rendered":"Recurring Conversations \u2013 Incremental Statistics (Part 1)"},"content":{"rendered":"<p>When I first started blogging, most of the material came from issues that I&#8217;d run into and how they were solved but, as I&#8217;ve spent most of the last 7 months not logging in to anything much ;-), it occurred to me that another area which I haven&#8217;t used for a long time is what I&#8217;ll call recurring conversations. <\/p>\n<p>Even though my blogging has slowed to a crawl, I still spend a lot of time having similar conversations with multiple people and on work chat channels on the same topics which indicates to me that those topics are not well understood. Because I work with a lot of smart people, it&#8217;s typically not the details that they struggle with. They&#8217;ve read detailed technical blog posts and have performed multiple web searches so have read the most detailed material available and yet somehow they&#8217;re missing the *point*. Maybe that&#8217;s the problem with learning everything via blogs and white papers? That it&#8217;s no substitute for someone explaining the fundamental concepts and design of features? I could probably rephrase that as, maybe there&#8217;s no substitute for actually reading a book or attending a course occasionally? I appreciate how out-of-date that view might be though.<\/p>\n<p>I&#8217;m sure some will have already realised that Recurring Conversations could probably be called Frequently Asked Questions, so let me begin this first post with <\/p>\n<p>&#8216;Why are my Global Statistics taking longer to gather when I use Oracle&#8217;s snazzy 11g Incremental Global Statistics feature than when I don&#8217;t?&#8217;<\/p>\n<p>This has baffled a lot of people I know because I&#8217;m not sure they understand fully why the feature was introduced. They want to convert one of their existing partitioned tables to use Incremental Global Statistics and so they test the performance by doing something like this.<\/p>\n<p>1)\u00a0Delete all of the stats on a large partitioned table.<br \/>2)\u00a0Set INCREMENTAL to FALSE and then gather table stats using GRANULARITY =&gt;&#8217;GLOBAL &#8216;<br \/>3)\u00a0Set INCREMENTAL to TRUE and then gather table stats using GRANULARITY =&gt;&#8217;GLOBAL &#8216;<\/p>\n<p dir=\"ltr\" style=\"margin-right: 0px\">When they time this they find that 3 takes just as long as 2 and, in fact, it takes a little longer! This is useless? What is the point of this new feature if it doesn&#8217;t speed up the gathering of Global stats? <\/p>\n<p>First I want to look at what we asked Oracle to do in steps 2) and 3) above.<\/p>\n<p>2) Visited all of the partitions of the table to gather information and then update the Global stats on the table.<br \/>3) Visited all of the partitions of the table to gather information, update the Global stats on the table and generate synopses for future use.<\/p>\n<p>On that basis, why *wouldn&#8217;t* option 3 take longer than option 2? They do more or less the same thing but 3) has to do a little additional work. <\/p>\n<p>So if it isn&#8217;t quicker to gather Global Stats using Incremental Global Statistics, why would you use it?<\/p>\n<p>The benefits don&#8217;t come from the initial gathering of Global Stats but when you gather stats on new Partitions and *don&#8217;t* need to gather Global Stats any more. Instead Oracle uses those handy synopses to update them which is a much quicker operation! The Real World cycle of use then looks like this.<\/p>\n<p>1)\u00a0Delete all of your existing table stats.<br \/>2)\u00a0Set INCREMENTAL to TRUE.<br \/>3)\u00a0Gather table stats using GRANULARITY =&gt;&#8217;GLOBAL\u00a0 AND PARTITION&#8217; without supplying\u00a0 a PARTNAME. This will re-gather all of your Global and Partition stats across the table and build the initial synopses. Note that at this stage you have achieved no reductions in stats collection times.<br \/>4)\u00a0As you load partitions with new data or the data changes and you need to update your stats, use one of a number of options but the one I tend to use is to gather the stats on each specific partition using GRANULARITY=&gt;&#8217; GLOBAL AND PARTITION&#8217;\u00a0 with PARTNAME set to the name of the partition we&#8217;ve just loaded. Oracle will now gather Partition stats on just the one Partition and update the Global Stats and the synopses based on the new data that&#8217;s been introduced. <\/p>\n<p>Bingo \u2013 you&#8217;ve just maintained accurate Global Stats without having to trawl through the entire table again! <\/p>\n<p>That&#8217;s the point. <\/p>\n<p>It&#8217;s about *not* gathering Global Stats but also not letting them drift hopelessly out of whack with the contents of the table. Measuring the performance of a full Global Stats gathering operation doesn&#8217;t illustrate the performance benefits.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I first started blogging, most of the material came from issues that I&#8217;d run into and how they were solved but, as I&#8217;ve spent most of the last 7 months not logging in to anything much ;-), it occurred to me that another area which I haven&#8217;t used for a long time is what&hellip; <a class=\"more-link\" href=\"http:\/\/orcldoug.com\/blog\/2014\/01\/29\/recurring-conversations-incremental-statistics-part-1\/\">Continue reading <span class=\"screen-reader-text\">Recurring Conversations \u2013 Incremental Statistics (Part 1)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1714","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":1719,"url":"http:\/\/orcldoug.com\/blog\/2014\/07\/24\/recurring-conversations-awr-intervals-part-2\/","url_meta":{"origin":1714,"position":0},"title":"Recurring Conversations: AWR Intervals (Part 2)","date":"July 24, 2014","format":false,"excerpt":"(Reminder, just in case we still need it, that the use of features in this post require Diagnostics Pack license.) Damn me for taking so long to write blog posts these days. By the time I get around to them, certain very knowledgeable people have commented on part 1 and\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1713,"url":"http:\/\/orcldoug.com\/blog\/2014\/07\/07\/recurring-conversations-awr-intervals-part-1\/","url_meta":{"origin":1714,"position":1},"title":"Recurring Conversations: AWR Intervals (Part 1)","date":"July 7, 2014","format":false,"excerpt":"I've seen plenty of blog posts and discussions over the years about the need to increase the default AWR retention period beyond the default value of 8 days. Experienced Oracle folk understand how useful it is to have a longer history of performance metrics to cover an entire workload period\u2026","rel":"","context":"With 6 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1724,"url":"http:\/\/orcldoug.com\/blog\/2014\/09\/25\/singapore\/","url_meta":{"origin":1714,"position":2},"title":"Singapore","date":"September 25, 2014","format":false,"excerpt":"Now, *this* is a post I should have written ages ago but somehow (as in most cases these days) Twitter overtook blogging because it is so much easier to write a bunch of tweets on a mobile device of some kind when living normal life than to sit down and\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":875,"url":"http:\/\/orcldoug.com\/blog\/2006\/01\/25\/application-security\/","url_meta":{"origin":1714,"position":3},"title":"Application Security","date":"January 25, 2006","format":false,"excerpt":"Some conversations are a recurring experience of DBA life.DBA [to software vendor] - 'So why does the application schema owner need to have the DBA role privilege?' Vendor - 'The installation procedure requires it' DBA - 'So can we revoke it after the installation?' Vendor - 'It hasn't been tested\u2026","rel":"","context":"With 4 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1636,"url":"http:\/\/orcldoug.com\/blog\/2011\/04\/26\/new-blog-round-up\/","url_meta":{"origin":1714,"position":4},"title":"New Blog Round-Up","date":"April 26, 2011","format":false,"excerpt":"I've spotted a few useful posts lately and a few friends have started blogging so I thought I'd draw people's attention to them.Neil Chandler is a UKOUG regular as well as a central and well-loved member of the informal London Oracle drinking massive (well, that's what I'll say about him\u2026","rel":"","context":"With 3 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1648,"url":"http:\/\/orcldoug.com\/blog\/2011\/09\/30\/mastering-oracle-trace-data-seminar-with-cary-millsap\/","url_meta":{"origin":1714,"position":5},"title":"Mastering Oracle Trace Data seminar with Cary Millsap","date":"September 30, 2011","format":false,"excerpt":"As I mentioned before, Cary Millsap was over in Europe recently and included a short trip to London to deliver his 1-day Mastering Oracle Trace Data seminar. By the time I found out, it was a little late to organise an onsite at my current client's place and in this\u2026","rel":"","context":"With 3 comments","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/18.133.199.212\/wp-content\/uploads\/recovered\/cary.jpg?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/1714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/comments?post=1714"}],"version-history":[{"count":0,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/1714\/revisions"}],"wp:attachment":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/media?parent=1714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/categories?post=1714"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/tags?post=1714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}