2. MySQL 8.0
Why to use 8.0 and How to use MDS on OCI
Frédéric Descamps
Community Manager
MySQL
January 2021
2 / 113
3. Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for information purpose only, and
may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality,
and should not be relied up in making purchasing decisions. The development, release, timing and pricing of any
features or functionality described for Oracle´s product may change and remains at the sole discretion of Oracle
Corporation.
Copyright @ 2021 Oracle and/or its affiliates.
3 / 113
10. MySQL is the most popular database
with developers
MySQL Developer Popularity
Stack Overflow Developer Survey 2020
Copyright @ 2021 Oracle and/or its affiliates.
10 / 113
12. "This is a landmark release as MySQL
eventually evolved beyond SQL-92 and the
purely relational dogma. Among a few other
standard SQL features, MySQL now
supports window functions (over) and
common table expressions (with). Without a
doubt, these are the two most important
post-SQL-92 features.”
MySQL 8.0: one giant leap for SQL
Copyright @ 2021 Oracle and/or its affiliates.
12 / 113
13. and still innovating !
Credits: @MarkusWinand - @ModernSQL
Copyright @ 2021 Oracle and/or its affiliates.
13 / 113
14. MySQL 8.0 is ...
Many, many new features !
Copyright @ 2021 Oracle and/or its affiliates.
14 / 113
15. SQL DML
CTEs
Window Functions
LATERAL
...
SQL DDL
Instant ADD COLUMN
RESTART
SET PERSIST
CHECK constraints, ...
Indexes
invisible
descending
functional, ...
Functions
REGEXP_...
BIN_TO_UUID
GROUPING, ...
Many New Features
Copyright @ 2021 Oracle and/or its affiliates.
15 / 113
16. JSON
new functions JSON_...
in-place updates
faster sorting
JSON Array Indexes, ...
GIS
spacial reference systems
geographic R-trees
length units in ST_Distance
...
Character sets
UTF-8 (utf8mb4) as default
General Unicode 9.0
collations, ...
Information_schema
Views over Data Dictionary
...
More New Features
Copyright @ 2021 Oracle and/or its affiliates.
16 / 113
17. Performance_Schema
PFS Indexes
instrumnent server errors
statement latency histograms,
...
Optimizer
histograms
hash join
NOWAIT, ...
InnoDB
new redo log design
lock scheduler (CATS)
persistent auto_increments
CLONE plugin!!, ...
SHOW
list hidden columns
list index information
Even More New Features
Copyright @ 2021 Oracle and/or its affiliates.
17 / 113
18. Data Dictionary
transactional DD
atomic & crash safe DDL
automatic upgrade, ...
Error Logging
error logging in JSON
lters for error log
new --log-slow-extra, ...
Replication
MTS per channel lters
atomic DDL recovery binlog
binary log encryption at rest
server version in binlog, ...
Network
multiple bind addresses
new admin port, ...
Again More New Features
Copyright @ 2021 Oracle and/or its affiliates.
18 / 113
19. Group Replication
Online Primary Election
Online Mode Switch
Consistency Levels, ...
Security
SQL Roles
dual passwords
data masking (Enterprise)
SSL certi cates rollout
Router
extra routing strategy
reduced metadata-cache TTL
or push method
REST API, ...
Shell
upgrade checker
import JSON
UDR and Plugins, ...
And Finally More New Features
Copyright @ 2021 Oracle and/or its affiliates.
19 / 113
26. * CREATE
* READ
* UPDATE
* DELETE
col->add({title: 'MySQL is Great', author: 'lefred' })
col-> nd()
collection.modify('author = "lefred"').set('author',
'kenny')
col.remove('author = "lefred"')
MySQL supports JSON & CRUD operations
It's possible to use MySQL without a single line
of SQL !
Copyright @ 2021 Oracle and/or its affiliates.
26 / 113
27. Migration from MongoDB to MySQL DS
For this example, I will use the well known restaurants collection:
Copyright @ 2021 Oracle and/or its affiliates.
27 / 113
28. Migration from MongoDB to MySQL DS
For this example, I will use the well known restaurants collection:
Copyright @ 2021 Oracle and/or its affiliates.
28 / 113
29. Let's make a query
Copyright @ 2021 Oracle and/or its affiliates.
29 / 113
30. Let's make a query
That's too much records to show in here... let's limit it
Copyright @ 2021 Oracle and/or its affiliates.
30 / 113
44. This function is described in SQL 2016,
chapter 6.27 and is also implemented in:
Oracle
SQL Server
DB2
SQL: JSON_VALUE NEW in 8.0.21
Copyright @ 2021 Oracle and/or its affiliates.
44 / 113
45. List the best restaurant of each type of
food and show the top 10, with the best
one first !
Copyright @ 2021 Oracle and/or its affiliates.
45 / 113
46. And all together !
Copyright @ 2021 Oracle and/or its affiliates.
46 / 113
47. And all together !
Copyright @ 2021 Oracle and/or its affiliates.
47 / 113
56. Index of a JSON array
A functional index over a JSON
expression
The expression evaluates to an array
Several index entries per row
One index entry per array element
General mechanism, currently used
for JSON arrays
Used to speed up array lookups
JSON_CONTAINS(...)
JSON_OVERLAPS(...)
MEMBER OF (...)
JSON Array Indexes
Copyright @ 2021 Oracle and/or its affiliates.
56 / 113
61. Modular
Easy to Extend
Each iterator encapsulates one operation
Same interface for all iterators
All operations can be connected
MySQL New Iterator Executor
Copyright @ 2021 Oracle and/or its affiliates.
61 / 113
62. Modular
Easy to Extend
Each iterator encapsulates one operation
Same interface for all iterators
All operations can be connected
MySQL New Iterator Executor
Copyright @ 2021 Oracle and/or its affiliates.
62 / 113
64. EXPLAIN ANALYZE
Instruments and executes the query
Estimated cost
Actual execution statistics
Time to return rst row
Time to return all rows
Number of rows returned
Number of loops
Uses the new tree output format also available in EXPLAIN
Copyright @ 2021 Oracle and/or its affiliates.
64 / 113
70. Hash Join
Typically faster than nested loop for large result sets
In-memory if possible
Spill to disk if necessary
Used in all types of joins (inner, equi, outer, semi, anti)
Replaces BNL in query plan
More Info: h ps://slideshare.net/NorvaldRyeng/mysql-8018-latest-updates-hash-join-
and-explain-analyze
Copyright @ 2021 Oracle and/or its affiliates.
70 / 113
73. Redo logging can now be enabled and disable
Very useful during initial data load !
mysql> ALTER INSTANCE DISABLE INNODB REDO_LOG;
Copyright @ 2021 Oracle and/or its affiliates.
73 / 113
74. MySQL 8.0: Sysbench IO-bound OLTP_RW,
8 tables, 50M rows each
New Double Write Buffer 15x Faster !!
Copyright @ 2021 Oracle and/or its affiliates.
74 / 113
75. New Binlog Compression !
Credits: @JWKrogh -
h ps://mysql.wisborg.dk/2020/05/07/mysql-compressed-binary-logs/
Copyright @ 2021 Oracle and/or its affiliates.
75 / 113
76. New Binlog Compression !
Credits: @JWKrogh -
h ps://mysql.wisborg.dk/2020/05/07/mysql-compressed-binary-logs/
Copyright @ 2021 Oracle and/or its affiliates.
76 / 113
77. and of course MySQL Clone
Copyright @ 2021 Oracle and/or its affiliates.
77 / 113
79. Error log available in performance_schema !
Copyright @ 2021 Oracle and/or its affiliates.
79 / 113
80. Error log available in performance_schema !
Copyright @ 2021 Oracle and/or its affiliates.
80 / 113
81. Which supports Group Replication since
MySQL 8.0.23
SOURCE_CONNECTION_AUTO_FAILOVER
With MySQL 8.0.22 there is new asynchronous connection failover mechanism to
automatically establish an asynchronous (source to replica) replication connection to a new
source after the existing connection from a replica to its source fails.
Copyright @ 2021 Oracle and/or its affiliates.
81 / 113
83. MySQL InnoDB Cluster
"A single product — MySQL — with high availability and scaling features baked in;
providing an integrated end-to-end solution that is easy to use."
Copyright @ 2021 Oracle and/or its affiliates.
83 / 113
84. MySQL InnoDB Cluster
"A single product — MySQL — with high availability and scaling features baked in;
providing an integrated end-to-end solution that is easy to use."
Copyright @ 2021 Oracle and/or its affiliates.
84 / 113
85. High Available Distributed MySQL DB
Fault tolerance
Automatic failover
Active/Active update anywhere (limits apply)
Automatic membership management
Adding/removing members
Network partitions, failures
Con ict detection and resolution
Prevents data loss
GPL
MySQL InnoDB Cluster
"A single product — MySQL — with high availability and scaling features baked in;
providing an integrated end-to-end solution that is easy to use."
Copyright @ 2021 Oracle and/or its affiliates.
85 / 113
86. Introducing MySQL InnoDB ReplicaSet!
8.0.19 Feature!
Fully integrated MySQL Router
Automatic Routing
Ease of use with MySQL Shell
Con guring, Adding, Removing members
Automatic Member Provisioning (CLONE)
MySQL InnoDB Replicaset
Copyright @ 2021 Oracle and/or its affiliates.
86 / 113
87. Replication Architecture:
(manual) Switchover & Failover
(asynchronous) Read Scaleout
'Simple' Replication architecture:
no network/hardware requirements
Providing Availability on PRIMARY when
issues with secondaries or network
MySQL InnoDB Replicaset
Copyright @ 2021 Oracle and/or its affiliates.
87 / 113
88. One Product: MySQL
All components developed together
Integration of all components
Full stack testing
MySQL InnoDB Cluster & ReplicaSet - Goals
Copyright @ 2021 Oracle and/or its affiliates.
88 / 113
89. One Product: MySQL
All components developed together
Integration of all components
Full stack testing
Easy to Use
One client: MySQL Shell
Integrated orchestration
Homogenous servers
MySQL InnoDB Cluster & ReplicaSet - Goals
Copyright @ 2021 Oracle and/or its affiliates.
89 / 113
90. One Product: MySQL
All components developed together
Integration of all components
Full stack testing
Easy to Use
One client: MySQL Shell
Integrated orchestration
Homogenous servers
MySQL InnoDB Cluster & ReplicaSet - Goals
Support DNS-SRV since 8.0.19 with our connectors
Copyright @ 2021 Oracle and/or its affiliates.
90 / 113
91. Solutions Easy to Deploy
Copyright @ 2021 Oracle and/or its affiliates.
91 / 113
92. MySQL InnoDB Cluster MySQL InnoDB ReplicaSet
js> c admin@mysql1
js> cluster = dba.createCluster('cluster')
js> c admin@mysql1
js> rs = dba.createReplicaSet('replicaset')
Solutions Easy to Deploy
Copyright @ 2021 Oracle and/or its affiliates.
92 / 113
93. MySQL InnoDB Cluster MySQL InnoDB ReplicaSet
js> c admin@mysql1
js> cluster = dba.createCluster('cluster')
js> c admin@mysql1
js> rs = dba.createReplicaSet('replicaset')
Con gure server to add later
js> dba.con gureInstance('admin@mysql2') js> dba.con gureReplicaSetInstance('admin@mysql2')
Solutions Easy to Deploy
Copyright @ 2021 Oracle and/or its affiliates.
93 / 113
94. MySQL InnoDB Cluster MySQL InnoDB ReplicaSet
js> c admin@mysql1
js> cluster = dba.createCluster('cluster')
js> c admin@mysql1
js> rs = dba.createReplicaSet('replicaset')
Con gure server to add later
js> dba.con gureInstance('admin@mysql2') js> dba.con gureReplicaSetInstance('admin@mysql2')
Add server to the Cluster
js> cluster.addInstance('admin@mysql2') js> rs.addInstance('admin@mysql2')
Solutions Easy to Deploy
Copyright @ 2021 Oracle and/or its affiliates.
94 / 113
95. MySQL InnoDB Cluster MySQL InnoDB ReplicaSet
js> c admin@mysql1
js> cluster = dba.createCluster('cluster')
js> c admin@mysql1
js> rs = dba.createReplicaSet('replicaset')
Con gure server to add later
js> dba.con gureInstance('admin@mysql2') js> dba.con gureReplicaSetInstance('admin@mysql2')
Add server to the Cluster
js> cluster.addInstance('admin@mysql2') js> rs.addInstance('admin@mysql2')
Bootstrap MySQL Router
$ sudo mysqlrouter --user=mysqlrouter --bootstrap
$ sudo systemctl start mysqlrouter
$ sudo mysqlrouter --user=mysqlrouter --bootstrap
$ sudo systemctl start mysqlrouter
Solutions Easy to Deploy
Copyright @ 2021 Oracle and/or its affiliates.
95 / 113
96. MySQL Database Architecture Summary
Single Region
Requirement Solution
RTO = hours, RPO = minutes MySQL Server w. Backups & Binary Log Sync
RTO = hours, RPO = less than a second MySQL Server w. Backups & Binary Log Stream
RTO = minutes, RPO = less than a second MySQL InnoDB ReplicaSet
RTO = seconds, RPO = 0 MySQL InnoDB Cluster
Multi Regions
Requirement Solution
RTO = minutes, RPO = seconds MySQL InnoDB Cluster w. asynchronous replica
RTO = seconds
and/or RPO = 0
Multi Region MySQL InnoDB Cluster w:
- 2 regions: consistency level AFTER
- 3 regions deployment
Copyright @ 2021 Oracle and/or its affiliates.
96 / 113
98. Various options but many questions
How to get the latest features, security xes?
How to provide security & regulatory compliance?
How to provide compatibility with on-premises?
How to integrate with Oracle technologies?
How to get expert MySQL technical support?
Only Oracle provides a MySQL Database Service
100% developed and managed by the MySQL team
100% built on MySQL Enterprise Edition
100% compatible with on-premises MySQL
100% compatible with Oracle technologies
100% supported by the MySQL Team
MySQL in the Cloud
Copyright @ 2021 Oracle and/or its affiliates.
98 / 113
99. MySQL Database Service
100% developed, managed, and supported by the MySQL team
Copyright @ 2021 Oracle and/or its affiliates.
99 / 113
102. MDS is integrated with other Oracle Services
End-to-end Integration from data ingestion to data visualization
Copyright @ 2021 Oracle and/or its affiliates.
102 / 113
104. Comparing against Amazon Aurora
4TB
(*)Benchmark queries are derived from TPC-H benchmark, but results are not comparable to published TPC-H benchmark results since they do not comply with TPC-H speci cation.
Copyright @ 2021 Oracle and/or its affiliates.
104 / 113
105. Performance advantage increases with data size
(*)Benchmark queries are derived from TPC-H benchmark, but results are not comparable to published TPC-H benchmark results since they do not comply with TPC-H speci cation.
Copyright @ 2021 Oracle and/or its affiliates.
105 / 113
106. Comparing against Redshift's fastest shape
4TB
(*)Benchmark queries are derived from TPC-H benchmark, but results are not comparable to published TPC-H benchmark results since they do not comply with TPC-H speci cation.
Copyright @ 2021 Oracle and/or its affiliates.
106 / 113
107. Comparing against Redshift's low-cost shape
4TB
(*)Benchmark queries are derived from TPC-H benchmark, but results are not comparable to published TPC-H benchmark results since they do not comply with TPC-H speci cation.
Copyright @ 2021 Oracle and/or its affiliates.
107 / 113
109. OCI Resource Manager Stacks
You can nd several Terraform Stacks you can user in OCI on my GitHub Repository:
https://github.com/lefred
Copyright @ 2021 Oracle and/or its affiliates.
109 / 113
110. MySQL Database Service - links
h ps://docs.oracle.com/en/learn/wrdprs_mysqldbs/
h ps://docs.oracle.com/en/learn/drupal_mysqldbs/
h ps://lefred.be/?s=oci
h ps://lefred.be/my-mysql-youtube-channel/
Copyright @ 2021 Oracle and/or its affiliates.
110 / 113
111. MySQL Database Service - links (2)
h ps://www.slideshare.net/lefred.descamps/mysql-database-service-webinar-
installing-drupal-in-oci-with-mds
h ps://www.slideshare.net/lefred.descamps/mysql-database-service-webinar-
upgrading-from-onpremise-mysql-to-mds
h ps://www.slideshare.net/lefred.descamps/mysql-database-service-webinar-
installing-wordpress-in-oci-with-mds
h ps://www.slideshare.net/lefred.descamps/oracle-developer-live-deploying-mysql-
innodb-cluster-on-oci-with-terraform
Copyright @ 2021 Oracle and/or its affiliates.
111 / 113
112. MySQL Resources
h ps://mysqlserverteam.com/
h ps://mysqlhighavailability.com/
h ps://www.mysql.com/news-and-events/web-seminars/
h ps://videohub.oracle.com/channel/MySQL+Webinars+and+Videos/
h ps://planet.mysql.com
Copyright @ 2021 Oracle and/or its affiliates.
112 / 113