{"id":1284,"date":"2007-06-10T12:00:00","date_gmt":"2007-06-10T12:00:00","guid":{"rendered":"http:\/\/orcldoug.com\/blog\/?p=1284"},"modified":"2007-06-10T12:00:00","modified_gmt":"2007-06-10T12:00:00","slug":"non-reusable-space","status":"publish","type":"post","link":"http:\/\/orcldoug.com\/blog\/2007\/06\/10\/non-reusable-space\/","title":{"rendered":"Non-reusable Space?"},"content":{"rendered":"<p>A problem cropped up at work this week and, whilst it wasn&#8217;t particularly tricky and didn&#8217;t take long to solve,  it struck me that the story of tracking it down might be useful and you might hit the problem yourself one day.<\/p>\n<p>A recently-deployed Data Warehouse database at work has a series of &#8216;LANDING&#8217; tables. Data is inserted into these tables on a regular basis as part of an ETL process. The database hasn&#8217;t been live for long, but the tables kept growing constantly, contrary to the developer&#8217;s expectations and the original space estimates. As this is just a staging area, the developers would delete old rows using a script but the tables never seemed to get much smaller. There were about 15-20 tables and they ranged in size from a few hundred MB to a couple of GB. <\/p>\n<p>The reason I&#8217;m a little vague on the details is that this wasn&#8217;t a database I was working on and it wasn&#8217;t me who fixed the problem in the end. However, one of our other DBAs described the situation and asked if I had any ideas. My first question was whether this was in an <a href=\"http:\/\/download-uk.oracle.com\/docs\/cd\/B19306_01\/server.102\/b14231\/tspaces.htm#ADMIN10065\">ASSM or non-ASSM tablespace<\/a> because Oracle uses completely different mechanisms for deciding whether a block is free to accept new rows or not. I just felt it was information I should know before looking about the problem. The answer was non-ASSM. It actually turned out later that ASSM <i>was<\/i> being used in error, probably because it&#8217;s the default on 10g. On a side-note, we&#8217;re in the process of discussing ASSM implementation at work, and I&#8217;ve been able to contribute quite a lot to that debate, with the assistance of some of Howard Roger&#8217;s <a href=\"http:\/\/www.dizwell.com\/prod\/node\/541\">articles<\/a> on the subject and sections of <a href=\"http:\/\/www.jlcomp.demon.co.uk\/\">Jonathan Lewis<\/a>&#8216; <a href=\"http:\/\/www.jlcomp.demon.co.uk\/cbo_book\/ind_book.html\">CBO book<\/a>.<\/p>\n<p>I suppose I should mention this is 10.2.0.2 on AIX 5.3 (I think) but, as I&#8217;m afraid to say I often find (because I think it&#8217;s a minority view) this was one of the many problems which are utterly generic in nature across all versions that I&#8217;m aware of.<\/p>\n<p>The first possible cause I thought of was &#8211; are they using INSERT \/*+ APPEND *\/ when they insert the data, i.e. Direct Path Inserts? The simplest way to identify this would be to see the code so, after a little digging around, I came across several PL\/SQL packages with MAP_ prefixed. Mmm, they looked like Oracle Warehouse Builder Mappings. Sure enough, there were several INSERT &#8230; SELECT statements in there for the relevant tables, all of which contained APPEND hints and were performing <a href=\"http:\/\/download-uk.oracle.com\/docs\/cd\/B19306_01\/server.102\/b14231\/tables.htm#sthref2243\">Direct Path Inserts<\/a>.<\/p>\n<p>In summary, the INSERT &#8230; SELECT statements would always use space above the High Water Mark so, regardless of how much space the DELETE operations freed from blocks below the HWM, those INSERTs were never going to use it. As an experiment, I thought I&#8217;d see what the <a href=\"http:\/\/download-uk.oracle.com\/docs\/cd\/B19306_01\/server.102\/b14231\/schema.htm#sthref2102\">Segment Advisor<\/a> made of this situation and, sure enough, it recognised that there was tons of space to be reclaimed. The problem was solved in the end (by the original DBA) by using segment shrink operations which I mentioned briefly in <a href=\"http:\/\/18.133.199.212\/?p=901\">another blog<\/a> (there&#8217;s more on ASSM there, too). Oh, to give you a rough idea how bad the situation had become, the shrink operations took between 20 and 45 minutes per table. When the process was repeated a day later, on the recently-shrunk segments, it was about a minute per table. Not very scientific, but it was clear that the situation has improved, not to mention that the segments were only a couple of percent of the size before the shrink operations!<\/p>\n<p>The longer term solution will be either to eliminate the Direct Path operations (do we <i>need<\/i> the performance benefit) or to modify the code so that it performs some space management operations itself &#8211; maybe the LANDING tables can be truncated when the data&#8217;s been used? At least we can pass some sensible suggestions back to the developers and Dev DBA now.<\/p>\n<p>Just bear in mind that if all of your INSERTs into a table have APPEND hints on them, there are space management issues to consider.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A problem cropped up at work this week and, whilst it wasn&#8217;t particularly tricky and didn&#8217;t take long to solve, it struck me that the story of tracking it down might be useful and you might hit the problem yourself one day. A recently-deployed Data Warehouse database at work has a series of &#8216;LANDING&#8217; tables.&hellip; <a class=\"more-link\" href=\"http:\/\/orcldoug.com\/blog\/2007\/06\/10\/non-reusable-space\/\">Continue reading <span class=\"screen-reader-text\">Non-reusable Space?<\/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-1284","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":1267,"url":"http:\/\/orcldoug.com\/blog\/2007\/05\/18\/log-buffer-45\/","url_meta":{"origin":1284,"position":0},"title":"Log Buffer #45","date":"May 18, 2007","format":false,"excerpt":"It's my turn again and, looking back at Log Buffer #4, I was amazed to realise that we're up to number 45 already and that my previous attempt was last August. Good work from Dave Edwards, who bears the organisational burden every week. Sooner him than me!I'll kick off this\u2026","rel":"","context":"With 2 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1306,"url":"http:\/\/orcldoug.com\/blog\/2007\/08\/07\/full-volume-database-refresh-part-3\/","url_meta":{"origin":1284,"position":1},"title":"Full Volume Database Refresh &#8211; Part 3","date":"August 7, 2007","format":false,"excerpt":"After solving the jigsaw puzzle and waiting for tape drives to do their thing, we've finally got a running test instance accessing a full copy of production. (Well, there was some recovery, faffing around with database names, control files, tempfiles, putting the database in noarchivelog mode and the rest, but\u2026","rel":"","context":"With 10 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1249,"url":"http:\/\/orcldoug.com\/blog\/2007\/04\/06\/a-shameful-attempt-to-accept-a-bribe-of-a-free-book\/","url_meta":{"origin":1284,"position":2},"title":"A Shameful Attempt to Accept a Bribe of a Free Book","date":"April 6, 2007","format":false,"excerpt":"I received this email from Toon Koppelaars yesterday about a book I'd been hearing about for a while.Lex de Haan and myself started writing a book entitled \"Applied Mathematics for Database Professionals\" (AM4DP) at the end of 2005. Finishing this book took a bit longer than anticipated, but I'm relieved\u2026","rel":"","context":"With 7 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":938,"url":"http:\/\/orcldoug.com\/blog\/2005\/09\/29\/html-db\/","url_meta":{"origin":1284,"position":3},"title":"HTML DB","date":"September 29, 2005","format":false,"excerpt":"Today I had one of those minor buzzes of excitement when I started to play around with Oracle's hosted HTML DB environment.Without wanting to go into my current feelings about work, you could say things are a little quiet. I'm trying to find things to do but I've joined just\u2026","rel":"","context":"With 2 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1294,"url":"http:\/\/orcldoug.com\/blog\/2007\/07\/12\/oracle-11g-total-recall\/","url_meta":{"origin":1284,"position":4},"title":"Oracle 11g &#8211; Total Recall","date":"July 12, 2007","format":false,"excerpt":"I suppose most readers will be aware that Oracle held a big launch for 11g yesterday, including the release of various technical docs at OTN. I've only managed a quick scan because I'm up to my eyeballs in some internal ASH\/AWR training I'm giving later today, but what particularly interested\u2026","rel":"","context":"With 5 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1050,"url":"http:\/\/orcldoug.com\/blog\/2006\/08\/10\/historical-perspective-part-2\/","url_meta":{"origin":1284,"position":5},"title":"Historical Perspective (Part 2)","date":"August 10, 2006","format":false,"excerpt":"Let's look at items 2 and 3 from the list in my previous blog1) You know you have a performance problem and can re-create it by running a specific part of the application, be it a user interaction or batch job.2) You have an intermittent but recurring performance problem which\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/1284","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=1284"}],"version-history":[{"count":0,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/1284\/revisions"}],"wp:attachment":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/media?parent=1284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/categories?post=1284"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/tags?post=1284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}