When most people think about Oracle Database In-Memory (Database In-Memory), the first thing that comes to mind is super fast scanning and filtering operations. But what you may not know is Database In-Memory also includes many SQL optimizations designed to accelerate star and snowflake type queries. We refer to this collection of SQL optimizations as In-Memory Aggregation (IMA). IMA is typically 3-10x faster than ‘conventional’ plans, and that’s in addition to the improvements provided by scanning and filtering the data via the In-Memory column store (IM column store).
IMA is designed to optimize queries that join one or more dimension tables to a fact table and aggregate data (for example, star queries).
To do this, IMA introduces three new SQL execution operations that optimize joins between relatively small tables (for example, dimension tables) and large tables (for example, fact tables) and aggregates data from the large table. These operations – KEY VECTOR CREATE, KEY VECTOR USE, and VECTOR GROUP BY – are used in a vector transform plan and typically replace operations such as hash joins, bloom filters and HASH GROUP BY. The vector transformation plan is more CPU efficient than alternative operations, resulting in faster queries and better concurrent user scalability.
The new IMA paper (recently posted on OTN) explains exactly how the vector transform works and walks you through a SQL execution plan, so I won’t repeat all that here but I will pull out of few of the main points:
- Queries eligible for the vector transform plan join dimension tables to fact tables and aggregate data from the fact table. There are a few additional details that are discussed in the paper.
- You can test the performance of a vector transform plan, use the VECTOR_TRANSFORM and NO_VECTOR_TRANSFORM hints.
- Vector transform plans can be used with conventional tables on disk providing that the Database In-Memory option is enabled.
Enjoy the paper and let me know if you have any questions about IMA!