{"id":3701,"date":"2025-05-29T16:44:47","date_gmt":"2025-05-29T16:44:47","guid":{"rendered":"https:\/\/w3buddy.com\/?post_type=cposts&#038;p=3701"},"modified":"2025-05-29T16:46:11","modified_gmt":"2025-05-29T16:46:11","slug":"in-memory-area","status":"publish","type":"cposts","link":"https:\/\/w3buddy.com\/blog\/notes\/getting-started-with-oracle-dba\/in-memory-area\/","title":{"rendered":"In-Memory Area"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\ud83e\udde0 <strong>Introduction<\/strong><br>Oracle In-Memory sounds complex, right? But it doesn\u2019t have to be.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s simply a smart way to speed up <strong>analytics and reporting<\/strong> without slowing down <strong>regular transactions<\/strong> (OLTP \u2013 Online Transaction Processing).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s make this easy to digest.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83e\udde9 <strong>What Is the In-Memory Area?<\/strong><br>The <strong>In-Memory Area<\/strong> is an <strong>optional<\/strong> part of the <strong>SGA (System Global Area)<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It contains the <strong>In-Memory Column Store (IM Column Store)<\/strong> \u2014 a special memory space where Oracle stores your data <strong>in column format<\/strong> for <strong>super-fast scanning<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83e\udde0 Key point:<br>Oracle stores data in <strong>two formats at the same time<\/strong>:<br>\u27a4 <strong>Row format<\/strong> in <strong>Buffer Cache<\/strong> (for fast OLTP)<br>\u27a4 <strong>Column format<\/strong> in <strong>IM Column Store<\/strong> (for fast analytics)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udccc This smart design doesn&#8217;t double memory usage!<br>The buffer cache stays small, while the IM column store handles large scans.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83e\udde0 <strong>What\u2019s Inside the In-Memory Column Store?<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>IMCU (In-Memory Compression Unit)<\/strong><br>\u27a4 Compressed, read-only blocks<br>\u27a4 Hold columnar data for one or more columns<\/li>\n\n\n\n<li><strong>SMU (Snapshot Metadata Unit)<\/strong><br>\u27a4 Stores metadata and transaction info for its IMCU<\/li>\n\n\n\n<li><strong>IMEU (In-Memory Expression Unit)<\/strong><br>\u27a4 Stores <strong>virtual columns<\/strong> and <strong>expression results<\/strong><br>\u27a4 Linked one-to-one with its parent IMCU<\/li>\n\n\n\n<li><strong>ESS (Expression Statistics Store)<\/strong><br>\u27a4 Tracks usage of expressions<br>\u27a4 Helps Oracle decide which expressions to optimize<br>\u27a4 Lives in memory <strong>and<\/strong> persists on disk<br>\ud83d\udccc ESS is <strong>always enabled<\/strong> \u2014 not tied to In-Memory Column Store<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udd0d Example:<br>Table <code>EMPLOYEES<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>IMCU holds: <code>weekly_salary<\/code><\/li>\n\n\n\n<li>IMEU stores:\n<ul class=\"wp-block-list\">\n<li>Auto-calculated: <code>weekly_salary * 52<\/code><\/li>\n\n\n\n<li>User-defined virtual column: <code>weekly_salary * 12<\/code><\/li>\n\n\n\n<li>Row 3 in IMCU = Row 3 in IMEU (1:1 mapping)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udcbe <strong>In-Memory Area Breakdown<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th>Pool Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>1MB Data Pool<\/td><td>Stores actual columnar data (IMCUs + IMEUs)<\/td><\/tr><tr><td>64KB Metadata Pool<\/td><td>Stores metadata (SMUs)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udccc Most of the memory goes to the 1MB pool.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Controlled by<\/strong>: <code>INMEMORY_SIZE<\/code> (default is 0)<br>\u27a4 <strong>Minimum required<\/strong>: 100MB<br>\u27a4 Can be <strong>increased on the fly<\/strong> (from Oracle 12.2 onwards)<br>\u27a4 Must increase by <strong>at least 128MB<\/strong><br>\u27a4 \u274c <strong>Cannot be decreased<\/strong> dynamically<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2699\ufe0f <strong>How and When Does Data Go In-Memory?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u27a4 When a table with the <code>INMEMORY<\/code> attribute is <strong>queried<\/strong><br>\u27a4 Or automatically at <strong>database startup<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udd04 Data is converted from on-disk row format to columnar format<br>\ud83d\udccc This conversion happens <strong>every time<\/strong> the instance restarts \u2014 because the IM Column Store exists <strong>only in memory<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 Even if a table is <strong>partially loaded<\/strong>, Oracle can run queries using what\u2019s in memory and fetch the rest from disk<br>(This is called a <strong>hybrid scan<\/strong>)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83e\udd16 <strong>Automatic In-Memory Magic<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Set <code>INMEMORY_AUTOMATIC_LEVEL = HIGH<\/code> to let Oracle:<br>\u2714\ufe0f Decide which objects to store<br>\u2714\ufe0f Populate objects based on usage<br>\u2714\ufe0f Recompress or evict segments as needed<br>\u2714\ufe0f Maximize memory usage automatically<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2699\ufe0f <strong>Background Processes That Help<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>IMCO<\/code> (In-Memory Coordinator): Triggers population<\/li>\n\n\n\n<li><code>SMCO<\/code> (Space Management Coordinator): Manages memory<\/li>\n\n\n\n<li><code>Wnnn<\/code> (Worker Processes): Do the actual work<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udd01 What happens on DML (Data Manipulation Language)?<br>\u27a4 Changes go to <strong>buffer cache \u2192 disk<\/strong><br>\u27a4 Then background processes <strong>repopulate<\/strong> the IM Column Store<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\ude80 <strong>In-Memory FastStart<\/strong><br>Want <strong>faster startup<\/strong>?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Enable <strong>In-Memory FastStart<\/strong> to write the columnar version of your data back to disk (in compressed format) at shutdown \u2014 making future startups much faster.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udccc But note: <strong>IMEUs<\/strong> (expression results) are <strong>not saved<\/strong> \u2014 they&#8217;re always repopulated from IMCUs<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u26a1 <strong>Performance Boosters to Know<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>In-Memory Hybrid Scans<\/strong><br>\u27a4 Combine row + column store access<br>\u27a4 Use in-memory data <strong>even if not all columns are loaded<\/strong><\/li>\n\n\n\n<li><strong>Deep Vectorization<\/strong><br>\u27a4 Uses <strong>SIMD (Single Instruction, Multiple Data)<\/strong> to boost complex SQL execution<br>\u27a4 Enabled by default<br>\u27a4 Can be turned off with:<br><code>ALTER SYSTEM SET INMEMORY_DEEP_VECTORIZATION = FALSE<\/code><\/li>\n\n\n\n<li><strong>Base Level Feature<\/strong><br>\u27a4 Use up to <strong>16GB<\/strong> of column store <strong>without licensing impact<\/strong><br>\u27a4 Great for test\/dev or small workloads<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udee0\ufe0f <strong>DBA Tip of the Day<\/strong><br>Don\u2019t put everything in memory \u2014 just your <strong>hot, performance-critical<\/strong> tables or columns.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Start small, monitor usage, and <strong>let Oracle automate<\/strong> where possible using <code>INMEMORY_AUTOMATIC_LEVEL<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83e\udde0 IntroductionOracle In-Memory sounds complex, right? But it doesn\u2019t have to be. It\u2019s simply a smart way to speed up analytics and reporting without slowing down regular transactions (OLTP \u2013 Online Transaction Processing). Let\u2019s make this easy to digest. \ud83e\udde9 What Is the In-Memory Area?The In-Memory Area is an optional part of the SGA (System [&hellip;]<\/p>\n","protected":false},"template":"","meta":{"googlesitekit_rrm_CAowu461DA:productID":""},"categories":[960,952],"class_list":["post-3701","cposts","type-cposts","status-publish","hentry","category-getting-started-with-oracle-dba","category-notes"],"_links":{"self":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts\/3701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts"}],"about":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/types\/cposts"}],"wp:attachment":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/media?parent=3701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/categories?post=3701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}