In-Memory Area

🧠 Introduction
Oracle In-Memory sounds complex, right? But it doesn’t have to be.

It’s simply a smart way to speed up analytics and reporting without slowing down regular transactions (OLTP – Online Transaction Processing).

Let’s make this easy to digest.

🧩 What Is the In-Memory Area?
The In-Memory Area is an optional part of the SGA (System Global Area).

It contains the In-Memory Column Store (IM Column Store) β€” a special memory space where Oracle stores your data in column format for super-fast scanning.

🧠 Key point:
Oracle stores data in two formats at the same time:
➀ Row format in Buffer Cache (for fast OLTP)
➀ Column format in IM Column Store (for fast analytics)

πŸ“Œ This smart design doesn’t double memory usage!
The buffer cache stays small, while the IM column store handles large scans.

🧠 What’s Inside the In-Memory Column Store?

  1. IMCU (In-Memory Compression Unit)
    ➀ Compressed, read-only blocks
    ➀ Hold columnar data for one or more columns
  2. SMU (Snapshot Metadata Unit)
    ➀ Stores metadata and transaction info for its IMCU
  3. IMEU (In-Memory Expression Unit)
    ➀ Stores virtual columns and expression results
    ➀ Linked one-to-one with its parent IMCU
  4. ESS (Expression Statistics Store)
    ➀ Tracks usage of expressions
    ➀ Helps Oracle decide which expressions to optimize
    ➀ Lives in memory and persists on disk
    πŸ“Œ ESS is always enabled β€” not tied to In-Memory Column Store

πŸ” Example:
Table EMPLOYEES:

  • IMCU holds: weekly_salary
  • IMEU stores:
    • Auto-calculated: weekly_salary * 52
    • User-defined virtual column: weekly_salary * 12
    • Row 3 in IMCU = Row 3 in IMEU (1:1 mapping)

πŸ’Ύ In-Memory Area Breakdown

Pool TypeDescription
1MB Data PoolStores actual columnar data (IMCUs + IMEUs)
64KB Metadata PoolStores metadata (SMUs)

πŸ“Œ Most of the memory goes to the 1MB pool.

Controlled by: INMEMORY_SIZE (default is 0)
➀ Minimum required: 100MB
➀ Can be increased on the fly (from Oracle 12.2 onwards)
➀ Must increase by at least 128MB
➀ ❌ Cannot be decreased dynamically

βš™οΈ How and When Does Data Go In-Memory?

➀ When a table with the INMEMORY attribute is queried
➀ Or automatically at database startup

πŸ”„ Data is converted from on-disk row format to columnar format
πŸ“Œ This conversion happens every time the instance restarts β€” because the IM Column Store exists only in memory

βœ… Even if a table is partially loaded, Oracle can run queries using what’s in memory and fetch the rest from disk
(This is called a hybrid scan)

πŸ€– Automatic In-Memory Magic

Set INMEMORY_AUTOMATIC_LEVEL = HIGH to let Oracle:
βœ”οΈ Decide which objects to store
βœ”οΈ Populate objects based on usage
βœ”οΈ Recompress or evict segments as needed
βœ”οΈ Maximize memory usage automatically

βš™οΈ Background Processes That Help

  • IMCO (In-Memory Coordinator): Triggers population
  • SMCO (Space Management Coordinator): Manages memory
  • Wnnn (Worker Processes): Do the actual work

πŸ” What happens on DML (Data Manipulation Language)?
➀ Changes go to buffer cache β†’ disk
➀ Then background processes repopulate the IM Column Store

πŸš€ In-Memory FastStart
Want faster startup?

Enable In-Memory FastStart to write the columnar version of your data back to disk (in compressed format) at shutdown β€” making future startups much faster.

πŸ“Œ But note: IMEUs (expression results) are not saved β€” they’re always repopulated from IMCUs

⚑ Performance Boosters to Know

  1. In-Memory Hybrid Scans
    ➀ Combine row + column store access
    ➀ Use in-memory data even if not all columns are loaded
  2. Deep Vectorization
    ➀ Uses SIMD (Single Instruction, Multiple Data) to boost complex SQL execution
    ➀ Enabled by default
    ➀ Can be turned off with:
    ALTER SYSTEM SET INMEMORY_DEEP_VECTORIZATION = FALSE
  3. Base Level Feature
    ➀ Use up to 16GB of column store without licensing impact
    ➀ Great for test/dev or small workloads

πŸ› οΈ DBA Tip of the Day
Don’t put everything in memory β€” just your hot, performance-critical tables or columns.

Start small, monitor usage, and let Oracle automate where possible using INMEMORY_AUTOMATIC_LEVEL.