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?
- IMCU (In-Memory Compression Unit)
β€ Compressed, read-only blocks
β€ Hold columnar data for one or more columns - SMU (Snapshot Metadata Unit)
β€ Stores metadata and transaction info for its IMCU - IMEU (In-Memory Expression Unit)
β€ Stores virtual columns and expression results
β€ Linked one-to-one with its parent IMCU - 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)
- Auto-calculated:
πΎ In-Memory Area Breakdown
| Pool Type | Description |
|---|---|
| 1MB Data Pool | Stores actual columnar data (IMCUs + IMEUs) |
| 64KB Metadata Pool | Stores 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 populationSMCO(Space Management Coordinator): Manages memoryWnnn(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
- In-Memory Hybrid Scans
β€ Combine row + column store access
β€ Use in-memory data even if not all columns are loaded - 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 - 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.
