SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
2014 © Trivadis 
BASEL BERN BRUGG LAUSANNE ZUERICH DUESSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MUNICH STUTTGART VIENNA 
Oracle Database In-Memory and the Query Optimizer 
UKOUG Tech14, Liverpool (GB) Christian Antognini 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
1
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
2 
@ChrisAntognini 
■Senior principal consultant, trainer and partner at Trivadis in Zurich (CH) 
■christian.antognini@trivadis.com 
■http://antognini.ch 
■Focus: get the most out of Oracle Database 
■Logical and physical database design 
■Query optimizer 
■Application performance management 
■Author of Troubleshooting Oracle Performance (Apress, 2008/2014) 
■OakTable Network, Oracle ACE Director
2014 © Trivadis 
1.In-Memory Column Store 
2.In-Memory Aggregation 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
3 
AGENDA
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
In-Memory Column Store 
4
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
5 
Architecture Overview
2014 © Trivadis 
■Data is populated into the IMCS in chunks called IM Column Unit (IMCU) 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
6 
IM Column Unit 

 
C1 
C2 
C3 
C1 
C2 
C3 
C1 
C2 
C3
2014 © Trivadis 
■They are similar to Exadata storage indexes 
■Do not store information about NULL values 
■They are automatically created and maintained for each column inside the IMCS 
■They are only stored in memory 
■They keep track of the minimum and maximum values in each IMCU 
■Their aim is to avoid accessing IMCUs that do not contain relevant data 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
7 
IM Storage Indexes
2014 © Trivadis 
■The cost model has been enhanced to be IM aware 
■It requires IM statistics 
■The total cost is a combination of both non-IM costs and IM costs 
■Enhancements are disabled if OPTIMIZER_INMEMORY_AWARE = FALSE or OPTIMIZER_FEATURES_ENABLE < 12.1.0.2 
■IMCS is not disabled 
■Costs are based on the former cost model 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
8 
IM-Aware Query Optimizer
2014 © Trivadis 
■The following statistics are used by the query optimizer: 
■Number of IMCUs 
■Number of blocks with data into the IMCUs 
■Number of rows stored into the IMCUs 
■Fraction of the rows stored into the IMCUs 
-Value between 0 and 1 
■Number of rows stored into the transaction journal 
■IM statistics are computed on the fly during hard parses 
■A cursors is not invalidated when the IM statistics it is based on changes 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
9 
IM Statistics
2014 © Trivadis 
■Two operations are related to IM scans: 
■TABLE ACCESS INMEMORY FULL 
■MAT_VIEW ACCESS INMEMORY FULL 
■Also used in case of Exadata storage 
■IM scans are selected by the query optimizer regardless of whether data is actually stored into the IMCS 
■The current behavior seems buggy to me 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
10 
IM Scans
2014 © Trivadis 
■Pruning based on storage indexes 
■Pruning based on compression metadata 
■Dictionary-based compression algorithms store metadata that contain a list of distinct values for each column within IMCU 
■Evaluation against compressed data is possible 
■Except for CAPACITY LOW/HIGH 
■Evaluation takes advantage of SIMD 
■Execution plans provide a new type of predicate: INMEMORY 
■Also used in case of predicates offloaded to Exadata storage 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
11 
Predicate Evaluation Taking Place During IM Scans
2014 © Trivadis 
■The query optimizer can generate predicates that are evaluated during IM scans 
■The generated predicates are used as explicit predicates 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
12 
Generation of Implied Predicates
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
13 
IM Scan Example 
SELECT * FROM t WHERE id = 1 OR id > 1 AND n < 42 
------------------------------------------- 
| Id | Operation | Name | 
------------------------------------------- 
| 0 | SELECT STATEMENT | | 
|* 1 | TABLE ACCESS INMEMORY FULL| T | 
------------------------------------------- 
1 - inmemory("ID">=1 AND ("N"<42 AND "ID">1 OR "ID"=1)) 
filter("N"<42 AND "ID">1 OR "ID"=1) 
Implied predicate
2014 © Trivadis 
■The INMEMORY_QUERY initialization parameter enables or disables IM scans at the session or system level 
■IM scans can also be controlled through the (NO_)INMEMORY hints 
■The hints override the INMEMORY_QUERY parameter 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
14 
Controlling IM Scans
2014 © Trivadis 
■Based on Bloom filters 
■Similar concept than parallel joins in previous versions, but executed serially 
■Filter created by the left input 
■Filter used by the right input 
■Only available for hash joins 
■Only the probe input have to be “IM-enabled” 
■The join is used to filter the false positives 
■IM joins can be controlled through the (NO_)PX_JOIN_FILTER hints 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
15 
IM Joins
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
16 
IM Join Example 
SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.n < 1E3 
------------------------------------------------ 
| Id | Operation | Name | 
------------------------------------------------ 
| 0 | SELECT STATEMENT | | 
|* 1 | HASH JOIN | | 
| 2 | JOIN FILTER CREATE | :BF0000 | 
|* 3 | TABLE ACCESS FULL | T1 | 
| 4 | JOIN FILTER USE | :BF0000 | 
|* 5 | TABLE ACCESS INMEMORY FULL| T2 | 
------------------------------------------------ 
1 - access("T1"."ID"="T2"."ID") 
3 - filter("T1"."N"<1E3) 
5 - inmemory(SYS_OP_BLOOM_FILTER(:BF0000,"T2"."ID")) 
filter(SYS_OP_BLOOM_FILTER(:BF0000,"T2"."ID"))
2014 © Trivadis 
■Table expansion is a cost-based transformation introduced in 11.2 to leverage partially unusable indexes 
■It has been made IM aware 
■Useful in case not all partitions are “IM-enabled” 
■It can be controlled through the (NO_)EXPAND_TABLE hints 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
17 
IM Table Expansion
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
18 
IM Table Expansion Example 
SELECT count(d) FROM t WHERE d BETWEEN :b1 AND :b2 
--------------------------------------------------------------------------- 
| Operation | Name | Pstart| Pstop | 
--------------------------------------------------------------------------- 
| SELECT STATEMENT | | | | 
| SORT AGGREGATE | | | | 
| VIEW | VW_TE_1 | | | 
| UNION-ALL | | | | 
| PARTITION RANGE SINGLE | | 11 | 11 | 
| TABLE ACCESS INMEMORY FULL | T | 11 | 11 | 
| PARTITION RANGE SINGLE | | 12 | 12 | 
| TABLE ACCESS BY LOCAL INDEX ROWID BATCHED| T | 12 | 12 | 
| INDEX RANGE SCAN | I | 12 | 12 | 
--------------------------------------------------------------------------- 
The IM scan is only enabled for the partition 4
2014 © Trivadis 
■The plan hash value is independent from the kind of FTS 
■TABLE ACCESS FULL 
■TABLE ACCESS STORAGE FULL 
■TABLE ACCESS INMEMORY FULL 
■Features like SQL plan baselines do not break when IMCS is enabled 
■The “best” execution plan can change 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
19 
Plan Hash Value
2014 © Trivadis 
■_INMEMORY_QUERY_SCAN controls IM scans (TRUE) 
■_OPTIMIZER_INMEMORY_ACCESS_PATH controls whether the query optimizer costs for IM (TRUE) 
■_OPTIMIZER_INMEMORY_BLOOM_FILTER controls IM joins (TRUE) 
■_OPTIMIZER_INMEMORY_GEN_PUSHABLE_PREDS controls the generation of implied predicates (TRUE) 
■_OPTIMIZER_INMEMORY_TABLE_EXPANSION controls IM table expansion (TRUE) 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
20 
Undocumented Parameters
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
In-Memory Aggregation 
21
2014 © Trivadis 
■To optimize queries against a star schema, the query optimizer should do the following: 
■Start evaluating each dimension table that has restrictions on it 
■Assemble a list with the resulting dimension keys 
■Use this list to extract the matching rows from the fact table 
■This approach cannot be implemented with regular joins 
■The query optimizer can join only two data sets at one time 
■Joining two dimension tables leads to a Cartesian product 
■To solve this problem, Oracle Database implements two query transformations: 
■Star transformation 
■Vector transformation (new in 12.1.0.2 – requires the In-Memory option) 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
22 
The Star Schema Challenge
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
23 
Star Transformation vs. Vector Transformation 
Selectivity 
Elapsed Time
2014 © Trivadis 
■In the documentation Oracle refers to it as In-Memory Aggregation 
■It isn’t only about aggregation 
■It requires the In-Memory option because it takes advantage of some of its features 
■INMEMORY_SIZE must be greater than 0 
■The query optimizer considers it when 
■equijoins are used 
■an aggregate function is applied to a column of the fact table 
■the query contains a GROUP BY clause 
-ROLLUP, CUBE and GROUPING SETS are not yet supported 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
24 
Vector Transformation (1)
2014 © Trivadis 
■It’s a cost-based query transformation 
■It can be controlled through the (NO_)VECTOR_TRANSFORM hints 
■As with the star transformation, sometimes is not possible to force it 
■It introduces new row source operations 
■KEY VECTOR CREATE 
■KEY VECTOR USE 
■VECTOR GROUP BY 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
25 
Vector Transformation (2)
2014 © Trivadis 
1.For every dimension table with a filter on it the following operations take place 
■Access table and filter data 
■Create key vector 
■Aggregate data 
■Create temporary table 
2.Access the fact table through a FTS and filter data by applying the key vectors 
■On Exadata the filter is not yet offloaded 
3.Aggregate data with either a vector or hash aggregation 
4.Join data from the fact table to temporary tables 
5.Join dimension tables without a filter on them 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
26 
Vector Transformation – Processing Steps
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
27 
Example 
SELECT c.customer_class, sum(o.order_total) 
FROM orders o, customers c, warehouses w 
WHERE o.customer_id = c.customer_id 
AND o.warehouse_id = w.warehouse_id 
AND c.dob BETWEEN :b1 AND :b2 
AND w.warehouse_name BETWEEN :b3 AND :b4 
GROUP BY c.customer_class 
customers 
orders 
warehouses
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
28 
Execution Plan – Access Dimension Tables, Create Key Vectors, and Create Temporary Tables 
------------------------------------------------------------------------- 
| Id | Operation | Name | 
------------------------------------------------------------------------- 
| 0 | SELECT STATEMENT | | 
| 1 | TEMP TABLE TRANSFORMATION | | 
| 2 | LOAD AS SELECT | SYS_TEMP_0FD9DE69C_28565764 | 
| 3 | VECTOR GROUP BY | | 
| 4 | KEY VECTOR CREATE BUFFERED | :KV0000 | 
|* 5 | TABLE ACCESS STORAGE FULL | CUSTOMERS | 
| 6 | LOAD AS SELECT | SYS_TEMP_0FD9DE69D_28565764 | 
| 7 | VECTOR GROUP BY | | 
| 8 | HASH GROUP BY | | 
| 9 | KEY VECTOR CREATE BUFFERED | :KV0001 | 
|* 10 | TABLE ACCESS STORAGE FULL | WAREHOUSES | 
...
2014 © Trivadis 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
29 
Execution Plan – Access Fact Table by Applying Key Vectors, and Join Temporary Tables 
... 
| 11 | HASH GROUP BY | | 
|* 12 | HASH JOIN | | 
| 13 | MERGE JOIN CARTESIAN | | 
| 14 | TABLE ACCESS STORAGE FULL | SYS_TEMP_0FD9DE69D_28565764 | 
| 15 | BUFFER SORT | | 
| 16 | TABLE ACCESS STORAGE FULL | SYS_TEMP_0FD9DE69C_28565764 | 
| 17 | VIEW | VW_VT_72AE2D8F | 
| 18 | VECTOR GROUP BY | | 
| 19 | HASH GROUP BY | | 
| 20 | KEY VECTOR USE | :KV0001 | 
| 21 | KEY VECTOR USE | :KV0000 | 
|* 22 | TABLE ACCESS STORAGE FULL| ORDERS | 
------------------------------------------------------------------------- 
... 
22 - filter(SYS_OP_KEY_VECTOR_FILTER("O"."CUSTOMER_ID",:KV0000) AND 
SYS_OP_KEY_VECTOR_FILTER("O"."WAREHOUSE_ID",:KV0001))
2014 © Trivadis 
Core Messages 
■In-Memory Column Store 
■The query optimizer is IM aware 
■In-Memory Aggregation 
■Very interesting concept, complements the star transformation 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
30
2014 © Trivadis 
Questions and answers ... 
BASEL BERN BRUGG LAUSANNE ZUERICH DUESSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MUNICH STUTTGART VIENNA 
Christian Antognini 
Principal Senior Consultant 
christian.antognini@trivadis.com 
11 December 2014 
Oracle Database In-Memory and the Query Optimizer 
31

Mais conteĂșdo relacionado

Mais procurados

Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTanel Poder
 
PostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability ImprovementsPostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability ImprovementsPGConf APAC
 
Top 10 tips for Oracle performance
Top 10 tips for Oracle performanceTop 10 tips for Oracle performance
Top 10 tips for Oracle performanceGuy Harrison
 
Indexing in Exadata
Indexing in ExadataIndexing in Exadata
Indexing in ExadataEnkitec
 
Larry Ellison Introduces Oracle Database In-Memory
Larry Ellison Introduces Oracle Database In-MemoryLarry Ellison Introduces Oracle Database In-Memory
Larry Ellison Introduces Oracle Database In-MemoryOracleCorporate
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuningGuy Harrison
 
Think Exa!
Think Exa!Think Exa!
Think Exa!Enkitec
 
Create your oracle_apps_r12_lab_with_less_than_us1000
Create your oracle_apps_r12_lab_with_less_than_us1000Create your oracle_apps_r12_lab_with_less_than_us1000
Create your oracle_apps_r12_lab_with_less_than_us1000Ajith Narayanan
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsNirav Shah
 
Crack the complexity of oracle applications r12 workload v2
Crack the complexity of oracle applications r12 workload v2Crack the complexity of oracle applications r12 workload v2
Crack the complexity of oracle applications r12 workload v2Ajith Narayanan
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder
 
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder
 
Best Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle OptimizerBest Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle OptimizerEdgar Alejandro Villegas
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaCuneyt Goksu
 
Oracle Database 12c "New features"
Oracle Database 12c "New features" Oracle Database 12c "New features"
Oracle Database 12c "New features" Anar Godjaev
 
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...Nelson Calero
 
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Kristofferson A
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014Enkitec
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaaCuneyt Goksu
 
Oracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesOracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesSaiful
 

Mais procurados (20)

Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
 
PostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability ImprovementsPostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability Improvements
 
Top 10 tips for Oracle performance
Top 10 tips for Oracle performanceTop 10 tips for Oracle performance
Top 10 tips for Oracle performance
 
Indexing in Exadata
Indexing in ExadataIndexing in Exadata
Indexing in Exadata
 
Larry Ellison Introduces Oracle Database In-Memory
Larry Ellison Introduces Oracle Database In-MemoryLarry Ellison Introduces Oracle Database In-Memory
Larry Ellison Introduces Oracle Database In-Memory
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
 
Think Exa!
Think Exa!Think Exa!
Think Exa!
 
Create your oracle_apps_r12_lab_with_less_than_us1000
Create your oracle_apps_r12_lab_with_less_than_us1000Create your oracle_apps_r12_lab_with_less_than_us1000
Create your oracle_apps_r12_lab_with_less_than_us1000
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tips
 
Crack the complexity of oracle applications r12 workload v2
Crack the complexity of oracle applications r12 workload v2Crack the complexity of oracle applications r12 workload v2
Crack the complexity of oracle applications r12 workload v2
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata Migrations
 
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)
 
Best Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle OptimizerBest Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle Optimizer
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
 
Oracle Database 12c "New features"
Oracle Database 12c "New features" Oracle Database 12c "New features"
Oracle Database 12c "New features"
 
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
 
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaa
 
Oracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesOracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slides
 

Semelhante a Oracle Database In-Memory and the Query Optimizer

Five Tips to Get the Most Out of Your Indexing
Five Tips to Get the Most Out of Your IndexingFive Tips to Get the Most Out of Your Indexing
Five Tips to Get the Most Out of Your IndexingMaria Colgan
 
Denodo Data Virtualization Platform Architecture: Performance (session 2 from...
Denodo Data Virtualization Platform Architecture: Performance (session 2 from...Denodo Data Virtualization Platform Architecture: Performance (session 2 from...
Denodo Data Virtualization Platform Architecture: Performance (session 2 from...Denodo
 
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRsMySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRsMayank Prasad
 
MySQL Performance Schema : fossasia
MySQL Performance Schema : fossasiaMySQL Performance Schema : fossasia
MySQL Performance Schema : fossasiaMayank Prasad
 
IBM Analytics Accelerator Trends & Directions Namk Hrle
IBM Analytics Accelerator  Trends & Directions Namk Hrle IBM Analytics Accelerator  Trends & Directions Namk Hrle
IBM Analytics Accelerator Trends & Directions Namk Hrle Surekha Parekh
 
IBM DB2 Analytics Accelerator Trends & Directions by Namik Hrle
IBM DB2 Analytics Accelerator  Trends & Directions by Namik Hrle IBM DB2 Analytics Accelerator  Trends & Directions by Namik Hrle
IBM DB2 Analytics Accelerator Trends & Directions by Namik Hrle Surekha Parekh
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ICarlos Oliveira
 
High Performance SSRS
High Performance SSRSHigh Performance SSRS
High Performance SSRSBert Wagner
 
How to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performanceHow to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performanceoysteing
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseParesh Patel
 
Closed-Loop Platform Automation by Tong Zhong and Emma Collins
Closed-Loop Platform Automation by Tong Zhong and Emma CollinsClosed-Loop Platform Automation by Tong Zhong and Emma Collins
Closed-Loop Platform Automation by Tong Zhong and Emma CollinsLiz Warner
 
Closed Loop Platform Automation - Tong Zhong & Emma Collins
Closed Loop Platform Automation - Tong Zhong & Emma CollinsClosed Loop Platform Automation - Tong Zhong & Emma Collins
Closed Loop Platform Automation - Tong Zhong & Emma CollinsLiz Warner
 
The Central View of your Data with Postgres
The Central View of your Data with PostgresThe Central View of your Data with Postgres
The Central View of your Data with PostgresEDB
 
Adaptive Query Optimization
Adaptive Query OptimizationAdaptive Query Optimization
Adaptive Query OptimizationAnju Garg
 
IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)Girish Srivastava
 
Tuning database performance
Tuning database performanceTuning database performance
Tuning database performanceBinay Acharya
 
Geek Sync | Top Metrics to Monitor in Your MySQL Databases
Geek Sync | Top Metrics to Monitor in Your MySQL DatabasesGeek Sync | Top Metrics to Monitor in Your MySQL Databases
Geek Sync | Top Metrics to Monitor in Your MySQL DatabasesIDERA Software
 
Sprint 123
Sprint 123Sprint 123
Sprint 123ManageIQ
 
Doag 2014 konrad-haefeli_in-memory-option-on-exadata
Doag 2014 konrad-haefeli_in-memory-option-on-exadataDoag 2014 konrad-haefeli_in-memory-option-on-exadata
Doag 2014 konrad-haefeli_in-memory-option-on-exadataTrivadis
 
JavaOne2013: Implement a High Level Parallel API - Richard Ning
JavaOne2013: Implement a High Level Parallel API - Richard NingJavaOne2013: Implement a High Level Parallel API - Richard Ning
JavaOne2013: Implement a High Level Parallel API - Richard NingChris Bailey
 

Semelhante a Oracle Database In-Memory and the Query Optimizer (20)

Five Tips to Get the Most Out of Your Indexing
Five Tips to Get the Most Out of Your IndexingFive Tips to Get the Most Out of Your Indexing
Five Tips to Get the Most Out of Your Indexing
 
Denodo Data Virtualization Platform Architecture: Performance (session 2 from...
Denodo Data Virtualization Platform Architecture: Performance (session 2 from...Denodo Data Virtualization Platform Architecture: Performance (session 2 from...
Denodo Data Virtualization Platform Architecture: Performance (session 2 from...
 
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRsMySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
 
MySQL Performance Schema : fossasia
MySQL Performance Schema : fossasiaMySQL Performance Schema : fossasia
MySQL Performance Schema : fossasia
 
IBM Analytics Accelerator Trends & Directions Namk Hrle
IBM Analytics Accelerator  Trends & Directions Namk Hrle IBM Analytics Accelerator  Trends & Directions Namk Hrle
IBM Analytics Accelerator Trends & Directions Namk Hrle
 
IBM DB2 Analytics Accelerator Trends & Directions by Namik Hrle
IBM DB2 Analytics Accelerator  Trends & Directions by Namik Hrle IBM DB2 Analytics Accelerator  Trends & Directions by Namik Hrle
IBM DB2 Analytics Accelerator Trends & Directions by Namik Hrle
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
 
High Performance SSRS
High Performance SSRSHigh Performance SSRS
High Performance SSRS
 
How to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performanceHow to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performance
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
 
Closed-Loop Platform Automation by Tong Zhong and Emma Collins
Closed-Loop Platform Automation by Tong Zhong and Emma CollinsClosed-Loop Platform Automation by Tong Zhong and Emma Collins
Closed-Loop Platform Automation by Tong Zhong and Emma Collins
 
Closed Loop Platform Automation - Tong Zhong & Emma Collins
Closed Loop Platform Automation - Tong Zhong & Emma CollinsClosed Loop Platform Automation - Tong Zhong & Emma Collins
Closed Loop Platform Automation - Tong Zhong & Emma Collins
 
The Central View of your Data with Postgres
The Central View of your Data with PostgresThe Central View of your Data with Postgres
The Central View of your Data with Postgres
 
Adaptive Query Optimization
Adaptive Query OptimizationAdaptive Query Optimization
Adaptive Query Optimization
 
IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)
 
Tuning database performance
Tuning database performanceTuning database performance
Tuning database performance
 
Geek Sync | Top Metrics to Monitor in Your MySQL Databases
Geek Sync | Top Metrics to Monitor in Your MySQL DatabasesGeek Sync | Top Metrics to Monitor in Your MySQL Databases
Geek Sync | Top Metrics to Monitor in Your MySQL Databases
 
Sprint 123
Sprint 123Sprint 123
Sprint 123
 
Doag 2014 konrad-haefeli_in-memory-option-on-exadata
Doag 2014 konrad-haefeli_in-memory-option-on-exadataDoag 2014 konrad-haefeli_in-memory-option-on-exadata
Doag 2014 konrad-haefeli_in-memory-option-on-exadata
 
JavaOne2013: Implement a High Level Parallel API - Richard Ning
JavaOne2013: Implement a High Level Parallel API - Richard NingJavaOne2013: Implement a High Level Parallel API - Richard Ning
JavaOne2013: Implement a High Level Parallel API - Richard Ning
 

Último

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂșjo
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...gurkirankumar98700
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Último (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Oracle Database In-Memory and the Query Optimizer

  • 1. 2014 © Trivadis BASEL BERN BRUGG LAUSANNE ZUERICH DUESSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MUNICH STUTTGART VIENNA Oracle Database In-Memory and the Query Optimizer UKOUG Tech14, Liverpool (GB) Christian Antognini 11 December 2014 Oracle Database In-Memory and the Query Optimizer 1
  • 2. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 2 @ChrisAntognini ■Senior principal consultant, trainer and partner at Trivadis in Zurich (CH) ■christian.antognini@trivadis.com ■http://antognini.ch ■Focus: get the most out of Oracle Database ■Logical and physical database design ■Query optimizer ■Application performance management ■Author of Troubleshooting Oracle Performance (Apress, 2008/2014) ■OakTable Network, Oracle ACE Director
  • 3. 2014 © Trivadis 1.In-Memory Column Store 2.In-Memory Aggregation 11 December 2014 Oracle Database In-Memory and the Query Optimizer 3 AGENDA
  • 4. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer In-Memory Column Store 4
  • 5. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 5 Architecture Overview
  • 6. 2014 © Trivadis ■Data is populated into the IMCS in chunks called IM Column Unit (IMCU) 11 December 2014 Oracle Database In-Memory and the Query Optimizer 6 IM Column Unit 
 C1 C2 C3 C1 C2 C3 C1 C2 C3
  • 7. 2014 © Trivadis ■They are similar to Exadata storage indexes ■Do not store information about NULL values ■They are automatically created and maintained for each column inside the IMCS ■They are only stored in memory ■They keep track of the minimum and maximum values in each IMCU ■Their aim is to avoid accessing IMCUs that do not contain relevant data 11 December 2014 Oracle Database In-Memory and the Query Optimizer 7 IM Storage Indexes
  • 8. 2014 © Trivadis ■The cost model has been enhanced to be IM aware ■It requires IM statistics ■The total cost is a combination of both non-IM costs and IM costs ■Enhancements are disabled if OPTIMIZER_INMEMORY_AWARE = FALSE or OPTIMIZER_FEATURES_ENABLE < 12.1.0.2 ■IMCS is not disabled ■Costs are based on the former cost model 11 December 2014 Oracle Database In-Memory and the Query Optimizer 8 IM-Aware Query Optimizer
  • 9. 2014 © Trivadis ■The following statistics are used by the query optimizer: ■Number of IMCUs ■Number of blocks with data into the IMCUs ■Number of rows stored into the IMCUs ■Fraction of the rows stored into the IMCUs -Value between 0 and 1 ■Number of rows stored into the transaction journal ■IM statistics are computed on the fly during hard parses ■A cursors is not invalidated when the IM statistics it is based on changes 11 December 2014 Oracle Database In-Memory and the Query Optimizer 9 IM Statistics
  • 10. 2014 © Trivadis ■Two operations are related to IM scans: ■TABLE ACCESS INMEMORY FULL ■MAT_VIEW ACCESS INMEMORY FULL ■Also used in case of Exadata storage ■IM scans are selected by the query optimizer regardless of whether data is actually stored into the IMCS ■The current behavior seems buggy to me 11 December 2014 Oracle Database In-Memory and the Query Optimizer 10 IM Scans
  • 11. 2014 © Trivadis ■Pruning based on storage indexes ■Pruning based on compression metadata ■Dictionary-based compression algorithms store metadata that contain a list of distinct values for each column within IMCU ■Evaluation against compressed data is possible ■Except for CAPACITY LOW/HIGH ■Evaluation takes advantage of SIMD ■Execution plans provide a new type of predicate: INMEMORY ■Also used in case of predicates offloaded to Exadata storage 11 December 2014 Oracle Database In-Memory and the Query Optimizer 11 Predicate Evaluation Taking Place During IM Scans
  • 12. 2014 © Trivadis ■The query optimizer can generate predicates that are evaluated during IM scans ■The generated predicates are used as explicit predicates 11 December 2014 Oracle Database In-Memory and the Query Optimizer 12 Generation of Implied Predicates
  • 13. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 13 IM Scan Example SELECT * FROM t WHERE id = 1 OR id > 1 AND n < 42 ------------------------------------------- | Id | Operation | Name | ------------------------------------------- | 0 | SELECT STATEMENT | | |* 1 | TABLE ACCESS INMEMORY FULL| T | ------------------------------------------- 1 - inmemory("ID">=1 AND ("N"<42 AND "ID">1 OR "ID"=1)) filter("N"<42 AND "ID">1 OR "ID"=1) Implied predicate
  • 14. 2014 © Trivadis ■The INMEMORY_QUERY initialization parameter enables or disables IM scans at the session or system level ■IM scans can also be controlled through the (NO_)INMEMORY hints ■The hints override the INMEMORY_QUERY parameter 11 December 2014 Oracle Database In-Memory and the Query Optimizer 14 Controlling IM Scans
  • 15. 2014 © Trivadis ■Based on Bloom filters ■Similar concept than parallel joins in previous versions, but executed serially ■Filter created by the left input ■Filter used by the right input ■Only available for hash joins ■Only the probe input have to be “IM-enabled” ■The join is used to filter the false positives ■IM joins can be controlled through the (NO_)PX_JOIN_FILTER hints 11 December 2014 Oracle Database In-Memory and the Query Optimizer 15 IM Joins
  • 16. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 16 IM Join Example SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.n < 1E3 ------------------------------------------------ | Id | Operation | Name | ------------------------------------------------ | 0 | SELECT STATEMENT | | |* 1 | HASH JOIN | | | 2 | JOIN FILTER CREATE | :BF0000 | |* 3 | TABLE ACCESS FULL | T1 | | 4 | JOIN FILTER USE | :BF0000 | |* 5 | TABLE ACCESS INMEMORY FULL| T2 | ------------------------------------------------ 1 - access("T1"."ID"="T2"."ID") 3 - filter("T1"."N"<1E3) 5 - inmemory(SYS_OP_BLOOM_FILTER(:BF0000,"T2"."ID")) filter(SYS_OP_BLOOM_FILTER(:BF0000,"T2"."ID"))
  • 17. 2014 © Trivadis ■Table expansion is a cost-based transformation introduced in 11.2 to leverage partially unusable indexes ■It has been made IM aware ■Useful in case not all partitions are “IM-enabled” ■It can be controlled through the (NO_)EXPAND_TABLE hints 11 December 2014 Oracle Database In-Memory and the Query Optimizer 17 IM Table Expansion
  • 18. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 18 IM Table Expansion Example SELECT count(d) FROM t WHERE d BETWEEN :b1 AND :b2 --------------------------------------------------------------------------- | Operation | Name | Pstart| Pstop | --------------------------------------------------------------------------- | SELECT STATEMENT | | | | | SORT AGGREGATE | | | | | VIEW | VW_TE_1 | | | | UNION-ALL | | | | | PARTITION RANGE SINGLE | | 11 | 11 | | TABLE ACCESS INMEMORY FULL | T | 11 | 11 | | PARTITION RANGE SINGLE | | 12 | 12 | | TABLE ACCESS BY LOCAL INDEX ROWID BATCHED| T | 12 | 12 | | INDEX RANGE SCAN | I | 12 | 12 | --------------------------------------------------------------------------- The IM scan is only enabled for the partition 4
  • 19. 2014 © Trivadis ■The plan hash value is independent from the kind of FTS ■TABLE ACCESS FULL ■TABLE ACCESS STORAGE FULL ■TABLE ACCESS INMEMORY FULL ■Features like SQL plan baselines do not break when IMCS is enabled ■The “best” execution plan can change 11 December 2014 Oracle Database In-Memory and the Query Optimizer 19 Plan Hash Value
  • 20. 2014 © Trivadis ■_INMEMORY_QUERY_SCAN controls IM scans (TRUE) ■_OPTIMIZER_INMEMORY_ACCESS_PATH controls whether the query optimizer costs for IM (TRUE) ■_OPTIMIZER_INMEMORY_BLOOM_FILTER controls IM joins (TRUE) ■_OPTIMIZER_INMEMORY_GEN_PUSHABLE_PREDS controls the generation of implied predicates (TRUE) ■_OPTIMIZER_INMEMORY_TABLE_EXPANSION controls IM table expansion (TRUE) 11 December 2014 Oracle Database In-Memory and the Query Optimizer 20 Undocumented Parameters
  • 21. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer In-Memory Aggregation 21
  • 22. 2014 © Trivadis ■To optimize queries against a star schema, the query optimizer should do the following: ■Start evaluating each dimension table that has restrictions on it ■Assemble a list with the resulting dimension keys ■Use this list to extract the matching rows from the fact table ■This approach cannot be implemented with regular joins ■The query optimizer can join only two data sets at one time ■Joining two dimension tables leads to a Cartesian product ■To solve this problem, Oracle Database implements two query transformations: ■Star transformation ■Vector transformation (new in 12.1.0.2 – requires the In-Memory option) 11 December 2014 Oracle Database In-Memory and the Query Optimizer 22 The Star Schema Challenge
  • 23. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 23 Star Transformation vs. Vector Transformation Selectivity Elapsed Time
  • 24. 2014 © Trivadis ■In the documentation Oracle refers to it as In-Memory Aggregation ■It isn’t only about aggregation ■It requires the In-Memory option because it takes advantage of some of its features ■INMEMORY_SIZE must be greater than 0 ■The query optimizer considers it when ■equijoins are used ■an aggregate function is applied to a column of the fact table ■the query contains a GROUP BY clause -ROLLUP, CUBE and GROUPING SETS are not yet supported 11 December 2014 Oracle Database In-Memory and the Query Optimizer 24 Vector Transformation (1)
  • 25. 2014 © Trivadis ■It’s a cost-based query transformation ■It can be controlled through the (NO_)VECTOR_TRANSFORM hints ■As with the star transformation, sometimes is not possible to force it ■It introduces new row source operations ■KEY VECTOR CREATE ■KEY VECTOR USE ■VECTOR GROUP BY 11 December 2014 Oracle Database In-Memory and the Query Optimizer 25 Vector Transformation (2)
  • 26. 2014 © Trivadis 1.For every dimension table with a filter on it the following operations take place ■Access table and filter data ■Create key vector ■Aggregate data ■Create temporary table 2.Access the fact table through a FTS and filter data by applying the key vectors ■On Exadata the filter is not yet offloaded 3.Aggregate data with either a vector or hash aggregation 4.Join data from the fact table to temporary tables 5.Join dimension tables without a filter on them 11 December 2014 Oracle Database In-Memory and the Query Optimizer 26 Vector Transformation – Processing Steps
  • 27. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 27 Example SELECT c.customer_class, sum(o.order_total) FROM orders o, customers c, warehouses w WHERE o.customer_id = c.customer_id AND o.warehouse_id = w.warehouse_id AND c.dob BETWEEN :b1 AND :b2 AND w.warehouse_name BETWEEN :b3 AND :b4 GROUP BY c.customer_class customers orders warehouses
  • 28. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 28 Execution Plan – Access Dimension Tables, Create Key Vectors, and Create Temporary Tables ------------------------------------------------------------------------- | Id | Operation | Name | ------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | 1 | TEMP TABLE TRANSFORMATION | | | 2 | LOAD AS SELECT | SYS_TEMP_0FD9DE69C_28565764 | | 3 | VECTOR GROUP BY | | | 4 | KEY VECTOR CREATE BUFFERED | :KV0000 | |* 5 | TABLE ACCESS STORAGE FULL | CUSTOMERS | | 6 | LOAD AS SELECT | SYS_TEMP_0FD9DE69D_28565764 | | 7 | VECTOR GROUP BY | | | 8 | HASH GROUP BY | | | 9 | KEY VECTOR CREATE BUFFERED | :KV0001 | |* 10 | TABLE ACCESS STORAGE FULL | WAREHOUSES | ...
  • 29. 2014 © Trivadis 11 December 2014 Oracle Database In-Memory and the Query Optimizer 29 Execution Plan – Access Fact Table by Applying Key Vectors, and Join Temporary Tables ... | 11 | HASH GROUP BY | | |* 12 | HASH JOIN | | | 13 | MERGE JOIN CARTESIAN | | | 14 | TABLE ACCESS STORAGE FULL | SYS_TEMP_0FD9DE69D_28565764 | | 15 | BUFFER SORT | | | 16 | TABLE ACCESS STORAGE FULL | SYS_TEMP_0FD9DE69C_28565764 | | 17 | VIEW | VW_VT_72AE2D8F | | 18 | VECTOR GROUP BY | | | 19 | HASH GROUP BY | | | 20 | KEY VECTOR USE | :KV0001 | | 21 | KEY VECTOR USE | :KV0000 | |* 22 | TABLE ACCESS STORAGE FULL| ORDERS | ------------------------------------------------------------------------- ... 22 - filter(SYS_OP_KEY_VECTOR_FILTER("O"."CUSTOMER_ID",:KV0000) AND SYS_OP_KEY_VECTOR_FILTER("O"."WAREHOUSE_ID",:KV0001))
  • 30. 2014 © Trivadis Core Messages ■In-Memory Column Store ■The query optimizer is IM aware ■In-Memory Aggregation ■Very interesting concept, complements the star transformation 11 December 2014 Oracle Database In-Memory and the Query Optimizer 30
  • 31. 2014 © Trivadis Questions and answers ... BASEL BERN BRUGG LAUSANNE ZUERICH DUESSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MUNICH STUTTGART VIENNA Christian Antognini Principal Senior Consultant christian.antognini@trivadis.com 11 December 2014 Oracle Database In-Memory and the Query Optimizer 31