SlideShare a Scribd company logo
Praveen GR
Associate database consultant,
Mydbops
July 17th, 2021
Mydbops 10th meetup
Parallel query in AWS Aurora
MySQL
Interested in Databases
Cloud database
Active Tech Speaker
Active Learner
About Me
Consulting
Services
Managed
Services
Focuses on Top Opensource database MySQL,
MongoDB and PostgreSQL
Mydbops Services
500 + Clients In 5 Yrs. of Operations
Our Clients
Agenda
1.	 About aurora
2. 	 Parallel query feature in Aurora and use case.
3. 	 Prerequisites.
4. 	 Implementation.
5. 	 Test case.
6. 	 Limitation.
About aurora
Aurora architecture
Read Read
Read
Write
Write
Write
Primary instance Aurora reader
Aurora reader
Availability zone a Availability zone b Availability zone c
About aurora
1.	 Volume level sync among the cluster node.
2. 	 Has it's own AZ of the volume in a different zone.
3. 	 The writer supports read and writes. Reader supports only reads.
4. 	 Up to 15 read replica is supported.
5. 	 Automated failure when the writer is down.
About aurora
6. 	 Dynamic disk adjustment.
7. 	 Aurora storage is also self-healing.
8. 	 Auto-scaling of the reader.
9. 	 Low-Latency Read Replicas.
10. 	 Custom endpoint with autoscaling.
Prominent Aurora MySQL feature
Prominent Aurora MySQL feature
1.	 Hash join in MySQL 5.7.
2. 	 Parallel query
3. 	 Storage Auto-Scaling
Parallel query in Aurora
Three steps in parallel query
1. 	 SQL execution in parallel.
2. 	 Splits among the cluster.
3. 	 Send required data to the network.
Architecture flow
Node 1
Node 4
Node 3
Node 2
Application
Use cases
Use cases
1.	 Better with query with equal, in, range.
2. 	 More optimised for analytical queries.
3. 	 Reduced IOPS and CPU utilisation.
4. 	 Uniform load sharing.
Prerequisites
Prerequisites
1.	 Aurora version > 2.09 or 1.23
2. 	 Instance class - R series
3. 	 Non-partitioned table.
4. 	 Hash join optimisation enabled.
Implementation
Implementation
Global variable
1.	 aurora_parallel_query = ON

2. 	 aurora_disable_hash_join = OFF
Test case
Monitoring
Status variable
1.	 Aurora_pq_request_attempted

2. 	 Aurora_pq_request_executed

3. 	 Aurora_pq_request_not_chosen_below_min_rows

4. 	 Aurora_pq_max_concurrent_requests

5. 	 Aurora_pq_request_in_progress
Lab Environment
Instance type  r3.large
Aurora version 2.09
MySQL version 5.7
 Table size 255 GB
Record creation sysbench
Test case
Without parallel query
mysql> explain select count(id) from sbtest1 where id > 12345 and k < 6789;
+----+-------------+---------+------------+-------+---------------+---------+---------+------+-----------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+---------+------------+-------+---------------+---------+---------+------+-----------+----------+-------------+
| 1 | SIMPLE | sbtest1 | NULL | range | PRIMARY | PRIMARY | 4 | NULL | 654698147 | 33.33 | Using where |
+----+-------------+---------+------------+-------+---------------+---------+---------+------+-----------+----------+-------------+
1 row in set, 1 warning (0.00 sec)
With parallel query
mysql> explain select count(id) from sbtest1 where id > 12345 and k < 6789;
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------
------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra
|
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------
------------+
| 1 | SIMPLE | sbtest1 | NULL | ALL | PRIMARY | NULL | NULL | NULL | 1309396294 | 16.66 | Using where; Using parallel query (2 columns, 2 filters, 0
exprs; 0 extra) |
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------
------------+
1 row in set, 1 warning (0.00 sec)
Explain plan
Test case
Explain Extra option

 

Columns No.of column in the query.
Filters
No.of column in where clause with
equal, not-equal, range.
Exprs
Column with function or operator , that
can proceed by the parallel query.
Extra
Number of expression that cannot be
proceed by parallel query.
Performance Analysis
Without parallel query
mysql> select sql_no_cache sum(k) from sbtest1 where upper(k)=231212 and upper(c) is not null;
+--------+
| sum(k) |
+--------+
| NULL |
+--------+
1 row in set (2 hours 33 min 22.40 sec)
With parallel query
mysql> select sql_no_cache sum(k) from sbtest1 where upper(k)=231212 and upper(c) is not null;
+--------+
| sum(k) |
+--------+
| NULL |
+--------+
1 row in set (1 min 6.61 sec)
With function
Performance Analysis
Without parallel query
CPU is in complete saturation for the query execution.
Performance Analysis
Without parallel query
Read latency of the server is high.
Performance Analysis
With parallel query
Single spike for query processing.
Performance Analysis
With parallel query
Test case ( using eq Ref )
Without parallel query
mysql> explain select sql_no_cache count(*) from sbtest1 where k=7256238746;
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+-------------+
| 1 | SIMPLE | sbtest1 | NULL | ALL | NULL | NULL | NULL | NULL | 1205294616 | 10.00 | Using where |
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+-------------+
1 row in set, 1 warning (0.00 sec)
With parallel query
mysql> explain select count(*) from sbtest1 where k=7256238746;
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------
------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra
|
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------
------------+
| 1 | SIMPLE | sbtest1 | NULL | ALL | NULL | NULL | NULL | NULL | 1205294616 | 10.00 | Using where; Using parallel query (1 columns, 0 filters, 1
exprs; 0 extra) |
+----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------
------------+
1 row in set, 1 warning (0.01 sec)
Explain plan
Performance
Without parallel query
mysql> select sql_no_cache count(*) from sbtest1 where k=7256238746;
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (2 hours 25 min 9.11 sec)
With parallel query
mmysql> select count(*) from sbtest1 where k=7256238746;
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (2 min 12.22 sec)
Performance Analysis
Without parallel query
CPU is in complete saturation for the query execution.
Performance
Without parallel query
Read latency of the server is high.
Performance
With parallel query
Single spike for query processing.
Performance Analysis
With parallel query
Test case ( Using Join Cond )
Without parallel query
mysql> explain select count(t1.k) from sbtest1 t1 inner join sbtest3 t2 on t1.id=t2.id where t1.k=247423;
+----+-------------+-------+------------+--------+---------------+---------+---------+--------------+----------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------------+--------+---------------+---------+---------+--------------+----------+----------+-------------+
| 1 | SIMPLE | t2 | NULL | index | PRIMARY | k_1 | 4 | NULL | 17588790 | 100.00 | Using index |
| 1 | SIMPLE | t1 | NULL | eq_ref | PRIMARY | PRIMARY | 4 | sbtest.t2.id | 1 | 10.00 | Using where |
+----+-------------+-------+------------+--------+---------------+---------+---------+--------------+----------+----------+-------------+
2 rows in set, 1 warning (0.00 sec)
With parallel query
mysql> explain select count(t1.k) from sbtest1 t1 inner join sbtest3 t2 on t1.id=t2.id where t1.k=247423;
+----+-------------+-------+------------+-------+---------------+------+---------+------+------------+----------+-----------------------------------------------------------------
---------------------------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra
|
+----+-------------+-------+------------+-------+---------------+------+---------+------+------------+----------+-----------------------------------------------------------------
---------------------------------------------------------+
| 1 | SIMPLE | t2 | NULL | index | PRIMARY | k_1 | 4 | NULL | 17588790 | 100.00 | Using index
|
| 1 | SIMPLE | t1 | NULL | ALL | PRIMARY | NULL | NULL | NULL | 1205294616 | 0.00 | Using where; Using join buffer (Hash Join Outer table t1); Using
parallel query (2 columns, 1 filters, 1 exprs; 0 extra) |
+----+-------------+-------+------------+-------+---------------+------+---------+------+------------+----------+-----------------------------------------------------------------
---------------------------------------------------------+
2 rows in set, 1 warning (0.00 sec)
Explain plan
Without parallel query
With parallel query
mysql> select count(t1.k) from sbtest1 t1 inner join sbtest3 t2 on t1.id=t2.id where t1.k=247423;
+-------------+
| count(t1.k) |
+-------------+
| 0 |
+-------------+
1 row in set (2 min 38.48 sec)
mysql> select sql_no_cache count(t1.k) from sbtest1 t1 inner join sbtest3 t2 on t1.id=t2.id where
t1.k=247423;
+-------------+
| count(t1.k) |
+-------------+
| 0 |
+-------------+
1 row in set (10 min 57.72 sec)
Performance Analysis
Performance
Without parallel query
Performance Analysis
Performance
Without parallel query
Performance Analysis
With parallel query
Performance Analysis
Performance
With parallel query
Performance Analysis
Performance Improvement
Efficiency
120
100
80
60
40
20
0
PQ Normal​
Method
Title
120
100
80
60
40
20
Normal PQ​
CPU
Performance Summary

 Without parallel Query With parallel query
Function 2 hrs 33 mins 1 min
Eq Ref 2 hrs 25 mins 2 mins
Join condition 10 mins 2 mins
Limitations
Limitation
1.Row format should not be compressed. Supports only dynamic
2. Won't work for smaller tables.
3. Limited number of parallel query execution.
4. Aurora version should > 2.09.
Reach Us : Info@mydbops.com
Thank You

More Related Content

What's hot

The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
Morgan Tocker
 

What's hot (20)

M|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write PathsM|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write Paths
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
 
Connection Pooling in PostgreSQL using pgbouncer
Connection Pooling in PostgreSQL using pgbouncer Connection Pooling in PostgreSQL using pgbouncer
Connection Pooling in PostgreSQL using pgbouncer
 
Deploying Flink on Kubernetes - David Anderson
 Deploying Flink on Kubernetes - David Anderson Deploying Flink on Kubernetes - David Anderson
Deploying Flink on Kubernetes - David Anderson
 
Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication
 
RocksDB compaction
RocksDB compactionRocksDB compaction
RocksDB compaction
 
MySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxMySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptx
 
Maxscale_메뉴얼
Maxscale_메뉴얼Maxscale_메뉴얼
Maxscale_메뉴얼
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Apache BookKeeper: A High Performance and Low Latency Storage Service
Apache BookKeeper: A High Performance and Low Latency Storage ServiceApache BookKeeper: A High Performance and Low Latency Storage Service
Apache BookKeeper: A High Performance and Low Latency Storage Service
 
Best Practice for Achieving High Availability in MariaDB
Best Practice for Achieving High Availability in MariaDBBest Practice for Achieving High Availability in MariaDB
Best Practice for Achieving High Availability in MariaDB
 
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte DataProblems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
 
Aurora Deep Dive | AWS Floor28
Aurora Deep Dive | AWS Floor28Aurora Deep Dive | AWS Floor28
Aurora Deep Dive | AWS Floor28
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
 
Modeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLModeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQL
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
 

Similar to Parallel Query in AWS Aurora MySQL

Applied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationApplied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System Presentation
Richard Crowley
 

Similar to Parallel Query in AWS Aurora MySQL (20)

MySQL SQL Tutorial
MySQL SQL TutorialMySQL SQL Tutorial
MySQL SQL Tutorial
 
MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527
 
Applied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationApplied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System Presentation
 
Explain
ExplainExplain
Explain
 
Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.
 
Advance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush MajumdarAdvance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush Majumdar
 
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
 
Basic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database AdministratorsBasic MySQL Troubleshooting for Oracle Database Administrators
Basic MySQL Troubleshooting for Oracle Database Administrators
 
16 MySQL Optimization #burningkeyboards
16 MySQL Optimization #burningkeyboards16 MySQL Optimization #burningkeyboards
16 MySQL Optimization #burningkeyboards
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a Nutshell
 
ANALYZE for Statements - MariaDB's hidden gem
ANALYZE for Statements - MariaDB's hidden gemANALYZE for Statements - MariaDB's hidden gem
ANALYZE for Statements - MariaDB's hidden gem
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
 
Fortify aws aurora_proxy_2019_pleu
Fortify aws aurora_proxy_2019_pleuFortify aws aurora_proxy_2019_pleu
Fortify aws aurora_proxy_2019_pleu
 
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 Design and Develop SQL DDL statements which demonstrate the use of SQL objec... Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 
Troubleshooting MySQL Performance
Troubleshooting MySQL PerformanceTroubleshooting MySQL Performance
Troubleshooting MySQL Performance
 
MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015MySQL 5.7 Tutorial Dutch PHP Conference 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015
 
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015MySQL 5.7. Tutorial - Dutch PHP Conference 2015
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
 

More from Mydbops

Efficient MySQL Indexing and what's new in MySQL Explain
Efficient MySQL Indexing and what's new in MySQL ExplainEfficient MySQL Indexing and what's new in MySQL Explain
Efficient MySQL Indexing and what's new in MySQL Explain
Mydbops
 

More from Mydbops (20)

Efficient MySQL Indexing and what's new in MySQL Explain
Efficient MySQL Indexing and what's new in MySQL ExplainEfficient MySQL Indexing and what's new in MySQL Explain
Efficient MySQL Indexing and what's new in MySQL Explain
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
 
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
 
Mastering Aurora PostgreSQL Clusters for Disaster Recovery
Mastering Aurora PostgreSQL Clusters for Disaster RecoveryMastering Aurora PostgreSQL Clusters for Disaster Recovery
Mastering Aurora PostgreSQL Clusters for Disaster Recovery
 
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
 
AWS RDS in MySQL 2023 Vinoth Kanna @ Mydbops OpenSource Database Meetup 15
AWS RDS in MySQL 2023 Vinoth Kanna @ Mydbops OpenSource Database Meetup 15AWS RDS in MySQL 2023 Vinoth Kanna @ Mydbops OpenSource Database Meetup 15
AWS RDS in MySQL 2023 Vinoth Kanna @ Mydbops OpenSource Database Meetup 15
 
Data-at-scale-with-TIDB Mydbops Co-Founder Kabilesh PR at LSPE Event
Data-at-scale-with-TIDB Mydbops Co-Founder Kabilesh PR at LSPE EventData-at-scale-with-TIDB Mydbops Co-Founder Kabilesh PR at LSPE Event
Data-at-scale-with-TIDB Mydbops Co-Founder Kabilesh PR at LSPE Event
 
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
 
Scaling-MongoDB-with-Horizontal-and-Vertical-Sharding Mydbops Opensource Data...
Scaling-MongoDB-with-Horizontal-and-Vertical-Sharding Mydbops Opensource Data...Scaling-MongoDB-with-Horizontal-and-Vertical-Sharding Mydbops Opensource Data...
Scaling-MongoDB-with-Horizontal-and-Vertical-Sharding Mydbops Opensource Data...
 
Mastering MongoDB Atlas: Essentials of Diagnostics and Debugging in the Cloud...
Mastering MongoDB Atlas: Essentials of Diagnostics and Debugging in the Cloud...Mastering MongoDB Atlas: Essentials of Diagnostics and Debugging in the Cloud...
Mastering MongoDB Atlas: Essentials of Diagnostics and Debugging in the Cloud...
 
Data Organisation: Table Partitioning in PostgreSQL
Data Organisation: Table Partitioning in PostgreSQLData Organisation: Table Partitioning in PostgreSQL
Data Organisation: Table Partitioning in PostgreSQL
 
Navigating MongoDB's Queryable Encryption for Ultimate Security - Mydbops
Navigating MongoDB's Queryable Encryption for Ultimate Security - MydbopsNavigating MongoDB's Queryable Encryption for Ultimate Security - Mydbops
Navigating MongoDB's Queryable Encryption for Ultimate Security - Mydbops
 
Data High Availability With TIDB
Data High Availability With TIDBData High Availability With TIDB
Data High Availability With TIDB
 
Mastering Database Migration_ Native replication (8.0) to InnoDB Cluster (8.0...
Mastering Database Migration_ Native replication (8.0) to InnoDB Cluster (8.0...Mastering Database Migration_ Native replication (8.0) to InnoDB Cluster (8.0...
Mastering Database Migration_ Native replication (8.0) to InnoDB Cluster (8.0...
 
Enhancing Security of MySQL Connections using SSL certificates
Enhancing Security of MySQL Connections using SSL certificatesEnhancing Security of MySQL Connections using SSL certificates
Enhancing Security of MySQL Connections using SSL certificates
 
Exploring the Fundamentals of YugabyteDB - Mydbops
Exploring the Fundamentals of YugabyteDB - Mydbops Exploring the Fundamentals of YugabyteDB - Mydbops
Exploring the Fundamentals of YugabyteDB - Mydbops
 
Time series in MongoDB - Mydbops
Time series in MongoDB - Mydbops Time series in MongoDB - Mydbops
Time series in MongoDB - Mydbops
 
TiDB in a Nutshell - Power of Open-Source Distributed SQL Database - Mydbops
TiDB in a Nutshell - Power of Open-Source Distributed SQL Database - MydbopsTiDB in a Nutshell - Power of Open-Source Distributed SQL Database - Mydbops
TiDB in a Nutshell - Power of Open-Source Distributed SQL Database - Mydbops
 
Achieving High Availability in PostgreSQL
Achieving High Availability in PostgreSQLAchieving High Availability in PostgreSQL
Achieving High Availability in PostgreSQL
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 

Parallel Query in AWS Aurora MySQL

  • 1. Praveen GR Associate database consultant, Mydbops July 17th, 2021 Mydbops 10th meetup Parallel query in AWS Aurora MySQL
  • 2. Interested in Databases Cloud database Active Tech Speaker Active Learner About Me
  • 3. Consulting Services Managed Services Focuses on Top Opensource database MySQL, MongoDB and PostgreSQL Mydbops Services
  • 4. 500 + Clients In 5 Yrs. of Operations Our Clients
  • 6. 1. About aurora 2. Parallel query feature in Aurora and use case. 3. Prerequisites. 4. Implementation. 5. Test case. 6. Limitation.
  • 8. Aurora architecture Read Read Read Write Write Write Primary instance Aurora reader Aurora reader Availability zone a Availability zone b Availability zone c
  • 9. About aurora 1. Volume level sync among the cluster node. 2. Has it's own AZ of the volume in a different zone. 3. The writer supports read and writes. Reader supports only reads. 4. Up to 15 read replica is supported. 5. Automated failure when the writer is down.
  • 10. About aurora 6. Dynamic disk adjustment. 7. Aurora storage is also self-healing. 8. Auto-scaling of the reader. 9. Low-Latency Read Replicas. 10. Custom endpoint with autoscaling.
  • 12. Prominent Aurora MySQL feature 1. Hash join in MySQL 5.7. 2. Parallel query 3. Storage Auto-Scaling
  • 14. Three steps in parallel query 1. SQL execution in parallel. 2. Splits among the cluster. 3. Send required data to the network.
  • 15. Architecture flow Node 1 Node 4 Node 3 Node 2 Application
  • 17. Use cases 1. Better with query with equal, in, range. 2. More optimised for analytical queries. 3. Reduced IOPS and CPU utilisation. 4. Uniform load sharing.
  • 19. Prerequisites 1. Aurora version > 2.09 or 1.23 2. Instance class - R series 3. Non-partitioned table. 4. Hash join optimisation enabled.
  • 21. Implementation Global variable 1. aurora_parallel_query = ON 2. aurora_disable_hash_join = OFF
  • 23. Monitoring Status variable 1. Aurora_pq_request_attempted 2. Aurora_pq_request_executed 3. Aurora_pq_request_not_chosen_below_min_rows 4. Aurora_pq_max_concurrent_requests 5. Aurora_pq_request_in_progress
  • 24. Lab Environment Instance type  r3.large Aurora version 2.09 MySQL version 5.7  Table size 255 GB Record creation sysbench
  • 25. Test case Without parallel query mysql> explain select count(id) from sbtest1 where id > 12345 and k < 6789; +----+-------------+---------+------------+-------+---------------+---------+---------+------+-----------+----------+-------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+---------+------------+-------+---------------+---------+---------+------+-----------+----------+-------------+ | 1 | SIMPLE | sbtest1 | NULL | range | PRIMARY | PRIMARY | 4 | NULL | 654698147 | 33.33 | Using where | +----+-------------+---------+------------+-------+---------------+---------+---------+------+-----------+----------+-------------+ 1 row in set, 1 warning (0.00 sec) With parallel query mysql> explain select count(id) from sbtest1 where id > 12345 and k < 6789; +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+---------------------------------------------------------------- ------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+---------------------------------------------------------------- ------------+ | 1 | SIMPLE | sbtest1 | NULL | ALL | PRIMARY | NULL | NULL | NULL | 1309396294 | 16.66 | Using where; Using parallel query (2 columns, 2 filters, 0 exprs; 0 extra) | +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+---------------------------------------------------------------- ------------+ 1 row in set, 1 warning (0.00 sec) Explain plan
  • 26. Test case Explain Extra option Columns No.of column in the query. Filters No.of column in where clause with equal, not-equal, range. Exprs Column with function or operator , that can proceed by the parallel query. Extra Number of expression that cannot be proceed by parallel query.
  • 27. Performance Analysis Without parallel query mysql> select sql_no_cache sum(k) from sbtest1 where upper(k)=231212 and upper(c) is not null; +--------+ | sum(k) | +--------+ | NULL | +--------+ 1 row in set (2 hours 33 min 22.40 sec) With parallel query mysql> select sql_no_cache sum(k) from sbtest1 where upper(k)=231212 and upper(c) is not null; +--------+ | sum(k) | +--------+ | NULL | +--------+ 1 row in set (1 min 6.61 sec) With function
  • 28. Performance Analysis Without parallel query CPU is in complete saturation for the query execution.
  • 29. Performance Analysis Without parallel query Read latency of the server is high.
  • 30. Performance Analysis With parallel query Single spike for query processing.
  • 32. Test case ( using eq Ref ) Without parallel query mysql> explain select sql_no_cache count(*) from sbtest1 where k=7256238746; +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+-------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+-------------+ | 1 | SIMPLE | sbtest1 | NULL | ALL | NULL | NULL | NULL | NULL | 1205294616 | 10.00 | Using where | +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+-------------+ 1 row in set, 1 warning (0.00 sec) With parallel query mysql> explain select count(*) from sbtest1 where k=7256238746; +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+---------------------------------------------------------------- ------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+---------------------------------------------------------------- ------------+ | 1 | SIMPLE | sbtest1 | NULL | ALL | NULL | NULL | NULL | NULL | 1205294616 | 10.00 | Using where; Using parallel query (1 columns, 0 filters, 1 exprs; 0 extra) | +----+-------------+---------+------------+------+---------------+------+---------+------+------------+----------+---------------------------------------------------------------- ------------+ 1 row in set, 1 warning (0.01 sec) Explain plan
  • 33. Performance Without parallel query mysql> select sql_no_cache count(*) from sbtest1 where k=7256238746; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set (2 hours 25 min 9.11 sec) With parallel query mmysql> select count(*) from sbtest1 where k=7256238746; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set (2 min 12.22 sec)
  • 34. Performance Analysis Without parallel query CPU is in complete saturation for the query execution.
  • 35. Performance Without parallel query Read latency of the server is high.
  • 36. Performance With parallel query Single spike for query processing.
  • 38. Test case ( Using Join Cond ) Without parallel query mysql> explain select count(t1.k) from sbtest1 t1 inner join sbtest3 t2 on t1.id=t2.id where t1.k=247423; +----+-------------+-------+------------+--------+---------------+---------+---------+--------------+----------+----------+-------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+-------+------------+--------+---------------+---------+---------+--------------+----------+----------+-------------+ | 1 | SIMPLE | t2 | NULL | index | PRIMARY | k_1 | 4 | NULL | 17588790 | 100.00 | Using index | | 1 | SIMPLE | t1 | NULL | eq_ref | PRIMARY | PRIMARY | 4 | sbtest.t2.id | 1 | 10.00 | Using where | +----+-------------+-------+------------+--------+---------------+---------+---------+--------------+----------+----------+-------------+ 2 rows in set, 1 warning (0.00 sec) With parallel query mysql> explain select count(t1.k) from sbtest1 t1 inner join sbtest3 t2 on t1.id=t2.id where t1.k=247423; +----+-------------+-------+------------+-------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------- ---------------------------------------------------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+-------+------------+-------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------- ---------------------------------------------------------+ | 1 | SIMPLE | t2 | NULL | index | PRIMARY | k_1 | 4 | NULL | 17588790 | 100.00 | Using index | | 1 | SIMPLE | t1 | NULL | ALL | PRIMARY | NULL | NULL | NULL | 1205294616 | 0.00 | Using where; Using join buffer (Hash Join Outer table t1); Using parallel query (2 columns, 1 filters, 1 exprs; 0 extra) | +----+-------------+-------+------------+-------+---------------+------+---------+------+------------+----------+----------------------------------------------------------------- ---------------------------------------------------------+ 2 rows in set, 1 warning (0.00 sec) Explain plan
  • 39. Without parallel query With parallel query mysql> select count(t1.k) from sbtest1 t1 inner join sbtest3 t2 on t1.id=t2.id where t1.k=247423; +-------------+ | count(t1.k) | +-------------+ | 0 | +-------------+ 1 row in set (2 min 38.48 sec) mysql> select sql_no_cache count(t1.k) from sbtest1 t1 inner join sbtest3 t2 on t1.id=t2.id where t1.k=247423; +-------------+ | count(t1.k) | +-------------+ | 0 | +-------------+ 1 row in set (10 min 57.72 sec) Performance Analysis
  • 45. Performance Summary Without parallel Query With parallel query Function 2 hrs 33 mins 1 min Eq Ref 2 hrs 25 mins 2 mins Join condition 10 mins 2 mins
  • 47. Limitation 1.Row format should not be compressed. Supports only dynamic 2. Won't work for smaller tables. 3. Limited number of parallel query execution. 4. Aurora version should > 2.09.
  • 48. Reach Us : Info@mydbops.com Thank You