Oracle Database In-Memory (Database In-Memory) is a suite of features, first introduced in Oracle Database 12c Release 1 (220.127.116.11), that greatly improves performance for real-time analytics and mixed workloads. The In-Memory Column Store (IM column store) is the key feature of Database In-Memory.
Database In-Memory features require the Oracle Database In-Memory option.
This chapter contains the following topics:
1.1 Challenges for Analytic Applications
Traditionally, obtaining good performance for analytic queries meant satisfying several requirements.
In a typical data warehouse or mixed-use database, requirements include the following:
You must understand user access patterns.
You must provide good performance, which typically requires creating indexes, materialized views, and OLAP cubes.
For example, if you create 1 to 3 indexes for a table (1 primary key and 2 foreign key indexes) to provide good performance for an OLTP application, then you may need to create additional indexes to provide good performance for analytic queries.
Figure 1-1 Multiple Indexes
Description of "Figure 1-1 Multiple Indexes"
Meeting the preceding requirements creates manageability and performance problems. Additional access structures cause performance overhead because you must create, manage, and tune them. For example, inserting a single row into a table requires an update to all indexes on this table, which increases response time.
The demand for real-time analytics means that more analytic queries are being executed in a mixed-workload database. The traditional approach is not sustainable.
1.2 The Single-Format Approach
Traditionally, relational databases store data in either row or columnar formats. Memory and disk store data in the same format.
An Oracle database stores rows contiguously in data blocks. For example, in a table with three rows, an Oracle data block stores the first row, and then the second row, and then the third row. Each row contains all column values for the row. Data stored in row format is optimized for transaction processing. For example, updating all columns in a small number of rows may modify only a small number of blocks.
To address the problems relating to analytic queries, some database vendors have introduced a columnar format. A columnar database stores selected columns—not rows—contiguously. For example, in a large sales table, the sales IDs reside in one column, and sales regions reside in a different column.
Analytical workloads access few columns while scanning, but scan the entire data set. For this reason, the columnar format is the most efficient for analytics. Because columns are stored separately, an analytical query can access only required columns, and avoid reading inessential data. For example, a report on sales totals by region can rapidly process many rows while accessing only a few columns.
Database vendors typically force customers to choose between a columnar and row-based format. For example, if the data format is columnar, then the database stores data in columnar format both in memory and on disk. Gaining the advantages of one format means losing the advantages of the alternate format. Applications either achieve rapid analytics or rapid transactions, but not both. The performance problems for mixed-use databases are not solved by storing data in a single format.
1.3 The Oracle Database In-Memory Solution
The Oracle Database In-Memory (Database In-Memory) feature set includes the In-Memory Column Store (IM column store), advanced query optimizations, and availability solutions.
The Database In-Memory optimizations enable analytic queries to run orders of magnitude faster on data warehouses and mixed-use databases.
This section contains the following topics:
1.3.1 What Is Database In-Memory?
The Database In-Memory feature set includes the IM column store, advanced query optimizations, and availability solutions.
Database In-Memory features combine to accelerate analytic queries by orders of magnitude without sacrificing OLTP performance or availability.
This section contains the following topics:
Oracle Database Licensing Information for to learn about the Database In-Memory option
18.104.22.168 IM Column Store
The IM column store maintains copies of tables, partitions, and individual columns in a special compressed columnar format that is optimized for rapid scans.
The IM column store resides in the In-Memory Area, which is an optional portion of the system global area (SGA). The IM column store does not replace row-based storage or the database buffer cache, but supplements it. The database enables data to be in memory in both a row-based and columnar format, providing the best of both worlds. The IM column store provides an additional transaction-consistent copy of table data that is independent of the disk format.
Figure 1-2 Dual-Format Database
Description of "Figure 1-2 Dual-Format Database"
Objects populated in the IM column store do not also need to be loaded into the buffer cache.
INMEMORY clause in DDL statements to enable the IM column store at any of the following levels:
Column (nonvirtual or virtual)
Table (internal or external), materialized view, or partition
INMEMORY attribute is specified at the tablespace level, then all new tables and materialized views in the tablespace are enabled for the IM column store by default. In the context of Database In-Memory, population is the automatic transformation of row-based data on disk into columnar data in the IM column store. You can configure all or a subset of a database object's columns for population in the IM column store. Similarly, for a partitioned table or materialized view, you can configure all or a subset of the partitions for population.
For example, you might configure three tables from the
sh schema for population into the IM column store:
sales. The IM column store stores the data for each table by column rather than by row, and divides each column into separate row subsets. A special container called an In-Memory Compression Unit (IMCU) stores all columns for a subset of rows in a table segment.
22.214.171.124 Advanced Query Optimizations
Database In-Memory includes several performance optimizations for analytic queries.
An expression is a combination of one or more values, operators, and SQL functions (
DETERMINISTIConly) that resolve to a value. By default, the In-Memory Expression (IM expression) optimization enables the
DBMS_INMEMORY_ADMIN.IME_CAPTURE_EXPRESSIONSprocedure to identify and populate “hot” expressions in the IM column store. An IM expression is materialized as a hidden virtual column, but is accessed in the same way as a non-virtual column.
A join group is a user-defined object that specifies a set of columns frequently used to join a set of tables. In certain queries, join groups enable the database to eliminate the performance overhead of decompressing and hashing column values.
For aggregation queries that join small dimension tables to a large fact table, In-Memory Aggregation (IM aggregation) uses the
VECTOR GROUP BYoperation to enhance performance. This optimization aggregates data during the scan of the fact table rather than afterward.
In the IM column store, repopulation is the automatic update of IMCUs after the data within them has been significantly modified. If an IMCU has stale entries but does not meet the staleness threshold, then background processes may instigate trickle repopulation, which is the gradual repopulation of the IM column store.
126.96.36.199 High Availability Support
Availability is the degree to which an application, service, or function is accessible on demand.
Database In-Memory supports the following availability features:
In-Memory FastStart (IM FastStart) reduces the time to populate data into the IM column store when a database instance restarts. IM FastStart achieves this by periodically saving a copy of the data currently populated in the IM column store on the disk in its compressed columnar format.
Each node in an Oracle Real Application Clusters (Oracle RAC) environment has its own IM column store. It is possible to have completely different objects populated on every node, or to have larger objects distributed across all IM column stores in the cluster. In Engineered Systems, it is also possible to have the same objects appear in the IM column store on every node.
Starting in Oracle Database 12c Release 2 (12.2), an IM column store is supported on a standby database in an Active Data Guard environment.
1.3.2 Improved Performance for Analytic Queries
The compressed columnar format enables faster scans, queries, joins, and aggregates.
This section contains the following topics:
188.8.131.52 Improved Performance for Data Scans
The columnar format provides fast throughput for scanning large amounts of data.
The IM column store enables you to analyze data in real time, enabling you to explore different possibilities and perform iterations. Specifically, the IM column store can drastically improve performance for queries that do the following:
Scan many rows and applies filters that use operators such as
Select few columns from a table or a materialized view that has many columns, such as a query that accesses 5 out of 100 columns
Select LOB columns using SQL operators
Columnar format uses fixed-width columns for most numeric and short string data types. This optimization enables rapid vector processing, which enables the database to answer queries faster.
Scans of the IM column store are faster than scans of row-based data for the following reasons:
Elimination of buffer cache overhead
The IM column store stores data in a pure, in-memory columnar format. The data does not persist in the data files (or generate redo), so the database avoids the overhead of reading data from disk into the buffer cache.
The database scans only the columns necessary for the query rather than entire rows of data. Furthermore, the database uses storage indexes and an internal dictionary to read only the necessary IMCUs for a specific query. For example, if a query requests all sales for a store with a store ID less than 8, then the database can use IMCU pruning to eliminate IMCUs that do not contain this value.
Traditionally, the goal of compression is to save space. In the IM column store, the goal of compression is to accelerate scans. The database automatically compresses columnar data using algorithms that allow
WHEREclause predicates to be applied against the compressed formats. Depending on the type of compression applied, Oracle Database can scan data in its compressed format without decompressing it first. Therefore, the volume of data that the database must scan in the IM column store is less than the corresponding volume in the database buffer cache.
Each CPU core scans local in-memory columns. To process data as an array (set), the scans use SIMD vector instructions. For example, a query can read a set of values in a single CPU instruction rather than read the values one by one. Vector scans by a CPU core are orders of magnitude faster than row scans.
For example, suppose a user executes the following ad hoc query:
SELECT cust_id, time_id, channel_id FROM sales WHERE prod_id BETWEEN 14 and 29
When using the buffer cache, the database would typically scan an index to find the product IDs, use the rowids to fetch the rows from disk into the buffer cache, and then discard the unwanted column values. Scanning data in row format in the buffer cache requires many CPU instructions, and can result in suboptimal CPU efficiency.
When using the IM column store, the database can scan only the requested
sales columns, avoiding disk altogether. Scanning data in columnar format pipelines only necessary columns to the CPU, increasing efficiency. Each CPU core scans local in-memory columns using SIMD vector instructions.
184.108.40.206 Improved Performance for Joins
A Bloom filter is a low-memory data structure that tests membership in a set. The IM column store takes advantage of Bloom filters to improve the performance of joins.
Bloom filters speed up joins by converting predicates on small dimension tables to filters on large fact tables. This optimization is useful when performing a join of multiple dimensions with one large fact table. The dimension keys on fact tables have many repeat values. The scan performance and repeat value optimization speeds up joins by orders of magnitude.
220.127.116.11 Improved Performance for Aggregation
An important aspect of analytics is to determine patterns and trends by aggregating data. Aggregations and complex SQL queries run faster when data is stored in the IM column store.
In Oracle Database, aggregation typically involves a
GROUP BY clause. Traditionally, the database used
HASH operators. Starting in Oracle Database 12c Release 1 (12.1), the database offered
VECTOR GROUP BY transformations to enable efficient in-memory, array-based aggregation.
During a fact table scan, the database accumulates aggregate values into in-memory arrays, and uses efficient algorithms to perform aggregation. Joins based on the primary key and foreign key relationships are optimized for both star schemas and snowflake schemas.
1.3.3 Improved Performance for Mixed Workloads
Although OLTP applications do not benefit from accessing data in the IM column store, the dual-memory format can indirectly improve OLTP performance.
When all data is stored in rows, improving analytic query performance requires creating access structures. The standard approach is to create analytic indexes, materialized views, and OLAP cubes. For example, a table might require 3 indexes to improve the performance of the OLTP application (1 primary key and 2 foreign key indexes) and 10-20 additional indexes to improve the performance of the analytic queries. While this technique can improve analytic query performance, it slows down OLTP performance. Inserting a row into the table requires modifying all indexes on the table. As the number of indexes increases, insertion speed decreases.
When you populate data into the IM column store, you can drop analytic access structures. This technique reduces storage space and processing overhead because fewer indexes, materialized views, and OLAP cubes are required. For example, an insert results in modifying 1-3 indexes instead of 11-23 indexes.
While the IM column store can drastically improve performance for analytic queries in business applications, ad-hoc analytic queries, and data warehouse workloads, pure OLTP databases that perform short transactions using index lookups benefit less. The IM column store does not improve performance for the following types of queries:
A query with complex predicates
A query that selects many columns
A query that returns many rows
Oracle Database Data Warehousing Guide to learn more about physical data warehouse design
1.3.4 In-Memory Support for Exadata Flash Cache
Not all objects marked
INMEMORY may fit in DRAM memory at the same time. If you use Oracle Exadata Storage Server Software, then Exadata Smart Flash Cache can serve as supplemental memory.
When the IM column store is enabled, Exadata Smart Flash Cache reformats data automatically into In-Memory columnar format. In previous Exadata releases, only Hybrid Column Compressed data was eligible for flash storage in IM columnar format. Starting in Oracle Exadata System Software 18c (18.1.0), the reformatting occurs for both compressed (including OLTP compression) and uncompressed tables.
With this format, most Database In-Memory performance enhancements are supported in Smart Scan, including joins and aggregation. Also, reformatting uncompressed and OLTP-compressed data blocks into IM columnar format can significantly reduce the amount of flash memory required.
Exadata Smart Flash Cache transforms the data in the following stages:
Oracle Exadata caches data from eligible scans in a legacy columnar format so that the data is available immediately. This format is columnar, but it is not the same format used by the IM column store.
In the background, Oracle Exadata reformats data into the pure IM column store format at a lower priority. The background writes prevent interference with the main workload.
If the database is not running an OLTP workload, then a data warehousing workload can consume 100% of the flash cache. However, an OLTP workload limits the data warehouse workload to no more than 50% of the flash cache. This optimization ensures that OLTP workload performance is not sacrificed for analytic scans.
By default, Exadata Smart Flash Cache compresses data using the level
MEMCOMPRESS FOR CAPACITY LOW. To change the compression level or disable the columnar format altogether, use the
ALTER TABLE ... NO CELLMEMORY statement.
1.3.5 High Availability Support
The IM column store is fully integrated into Oracle Database. All High Availability features are supported.
The columnar format does not change the Oracle database on-disk storage format. Thus, buffer cache modifications and redo logging function in the same way. Features such as RMAN, Oracle Data Guard, and Oracle ASM are fully supported.
In an Oracle Real Application Clusters (Oracle RAC) environment, each node has its own IM column store by default. Depending on your requirements, you can populate objects in different ways:
Different tables are populated on every node. For example, the
salesfact table is on one node, whereas the
productsdimension table is on a different node.
A single table is distributed among different nodes. For example, different partitions of the same hash-partitioned table are on different nodes, or different rowid ranges of a single nonpartitioned table are on different nodes.
Some objects appear in the IM column store on every node. For example, you might populate the
productsdimension table in every node, but distribute partitions of the
salesfact table across different nodes.
1.3.6 Ease of Adoption
Database In-Memory is simple to implement, and requires no application changes.
Key aspects of Database In-Memory adoption include:
Ease of deployment
No user-managed data migration is required. The database stores data in row format on disk and automatically converts row data into columnar format when populating the IM column store.
Compatibility with existing applications
No application changes are required. The optimizer automatically takes advantage of the columnar format. If your application connects to the database and issues SQL, then it can benefit from Database In-Memory features.
Full SQL compatibility
Database In-Memory places no restrictions on SQL. Analytic queries can benefit whether they use Oracle analytic functions or customized PL/SQL code.
Ease of use
No complex setup is required. The
INMEMORY_SIZEinitialization parameter specifies the amount of memory reserved for use by the IM column store. The
INMEMORYclause in DDL statements specifies the objects or columns to be populated into the IM column store. By configuring the IM column store, you can immediately improve the performance of existing analytic workloads and ad-hoc queries.
1.4 Prerequisites for Database In-Memory
The Oracle Database In-Memory option is required for all Database In-Memory features. No special hardware is required for an IM column store.
The IM column store requires a minimum of 100 MB of memory. The store size is included in
For Oracle RAC databases, the
DUPLICATE ALLoptions require Oracle Engineered Systems.
Oracle Database Licensing Information for all licensing-related information
1.5 Principal Tasks for Database In-Memory
For queries to benefit from the IM column store, the only required tasks are sizing the IM column store, and specifying objects for population. Query optimization and availability features require additional configuration.
Principal Tasks for Configuring the IM Column Store
The following table lists the principal configuration tasks.
Table 1-1 Configuration Tasks
|Task||Notes||To Learn More|
Enable the IM column store by specifying its size.
Specify tables (internal or external), columns (nonvirtual or virtual), tablespaces, or materialized views for population into the IM column store.
Optionally, create Automatic Data Optimization (ADO) policies to set
For example, a policy can evict the
Principal Tasks for Optimizing In-Memory Queries
In-Memory query optimizations are not required for the IM column store to function. The following optimization tasks are optional.
Table 1-2 Query Optimization Tasks
|Task||Notes||To Learn More|
Manage automatic detection of IM expressions in the IM column store by using the
For example, invoke the
Define join groups using the
Candidates are columns that are frequently paired in a join predicate, for example, a column joining a fact and dimension table.
If necessary for a query block, specify the
In-memory aggregation is an automatically enabled feature that cannot be controlled with initialization parameters or DDL.
Limit the number of IMCUs updated through trickle repopulation within a two minute interval by setting the initialization parameter
You can disable trickle repopulation by setting this initialization parameter to
Principal Tasks for Managing Availability
The principal tasks are shown in the following table.
Table 1-3 Availability Tasks
|Task||Notes||To Learn More|
Specify an In-Memory FastStart (IM FastStart) tablespace using the
IM FastStart optimizes the population of database objects in the IM column store when the database is restarted. IM FastStart stores information on disk for faster population of the IM column store.
For an object or tablespace, specify
By default, each In-Memory object is distributed among the Oracle RAC instances, effectively employing a share-nothing architecture for the IM column store.
In an Oracle Data Guard environment, you can use the same Database In-Memory initialization parameters and statements on a primary or standby database.
For example, you can enable the IM column store on both a primary and standby database by setting
1.6 Tools for the IM Column Store
No special tools or utilities are required to manage the IM column store or other Database In-Memory features. Administrative tools such as SQL*Plus, SQL Developer, and Oracle Enterprise Manager (Enterprise Manager) are fully supported.
This section describes tools that have specific Database In-Memory feature support:
1.6.1 In-Memory Advisor
The In-Memory Advisor is a downloadable PL/SQL package that analyzes the analytical processing workload in your database.
The In-Memory Advisor differentiates analytics processing from other database activity based on SQL plan cardinality, Active Session History (ASH), parallel query usage, and other statistics. The In-Memory Advisor estimates the size of objects in the IM column store based on statistics and heuristic compression factors.
The advisor estimates analytic processing performance improvement factors based on the following:
Elimination of wait events such as user I/O waits, cluster transfer waits, and buffer cache latch waits
Query processing advantages related to specific compression types
Decompression cost heuristics for specific compression types
SQL plan cardinality, number of columns in the result set, and so on
The output is a report that recommends a size for the IM column store and a list of objects that would benefit from In-Memory population. The advisor also generates a SQL*Plus script that alters the recommended objects with the
The In-Memory Advisor is not included in the stored PL/SQL packages. You must download the package from Oracle Support.
My Oracle Support note 1965343.1 to learn more about the In-Memory Advisor:
1.6.2 Cloud Control Pages for the IM Column Store
Enterprise Manager Cloud Control (Cloud Control) provides the In-Memory Column Store Central Home page. This page gives a dashboard interface to the IM column store.
Use this page to monitor in-memory support for database objects such as tables, indexes, partitions and tablespaces. You can view In-Memory functionality for objects and monitor their In-Memory usage statistics. Unless otherwise stated, this manual describes the command-line interface to Database In-Memory features.
1.6.3 Oracle Compression Advisor
Oracle Compression Advisor estimates the compression ratio that you can realize using the
MEMCOMPRESS clause. The advisor uses the
Oracle Database PL/SQL Packages and Types Reference to learn more about
1.6.4 Oracle Data Pump and the IM Column Store
You can import database objects that are enabled for the IM column store using the
TRANSFORM=INMEMORY:y option of the
With this option, Oracle Data Pump keeps the IM column store clause for all objects that have one. When the
TRANSFORM=INMEMORY:n option is specified, Data Pump drops the IM column store clause from all objects that have one.
You can also use the
string option to override the IM column store clause for a database object in the dump file during import. For example, you can use this option to change the IM column store compression for an imported database object.
Oracle Database Utilities for more information about the
TRANSFORM impdb parameter