MySQL 8.0 New Features Overview
for cPanel Customers
Dave Stokes
Community Manager, North America
MySQL Community Team
Copyright © 2019 Oracle and/or its affiliates.
The following is intended to outline our general product direction. It is intended for information purposes
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 upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A
detailed discussion of these factors and other risks that affect our business is contained in Oracle’s
Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K
and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or
on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as
of September 2019 and Oracle undertakes no duty to update any statement in light of new information
or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
MySQL 8.0 New Features Overview
for cPanel Customers
Dave Stokes
Community Manager, North America
MySQL Community Team
Copyright © 2019 Oracle and/or its affiliates.
Our Goal
MySQL 8.0 was a big advancement over
the previous version, MySQL 5.7 and this
presentation is a general overview of some
of the new features.
There are many new facets not covered by
this presentation and hopefully you will be
able to explore them later.
Copyright © 2019 Oracle and/or its affiliates.
MySQL 5.6
If you are using MySQL 5.6 please note that
it reaches End of Life status for support and
updates in February 2021.
Please upgrade if you are using this version
of MySQL!
Copyright © 2019 Oracle and/or its affiliates.
What is MySQL?
• Relational Database Management System
• GPLv2 licensed Community Edition
• Licensed Enterprise Edition
Monitoring software, improved backup, at rest encryption, data masking, db firewall, key
chain management, and support
• Also a NoSQL JSON Document Store Database
• Also language connectors, Router, Shell, InnoDB Cluster
• And more!
Copyright © 2019 Oracle and/or its affiliates.
25 Years old!!
What Happened to MySQL 6.0 and 7.0????
There was an early MySQL 6.0 that withered on the vine and
software was included in the 5.0 series
NDB Cluster has used the 7 series for many years
So engineering thought we earned the 8.0 series which
became generally available in April 2018
My Top Seven
Features of
MySQL 8.0!
1.Data Dictionary
All the metadata is stored within the database itself. No more
pletoria of little files under /var/lib/mysql -- saves inodes, disk
space, and ‘rm accidents’.
Good new: You can now have millions of tables in a schema.
Bad news: You can now have millions of tables in a schema.
2. Better SQL
1. Windowing Functions
2. Lateral Derived Tables
3. Common Table Expressions
4. ROW & TABLE
SELECT date, amount,
sum(amount)
OVER w AS ‘sum’
FROM payments
WINDOW w AS
(ORDER BY date
RANGE BETWEEN
INTERVAL 1 WEEK PRECEDING
AND CURRENT ROW)
ORDER BY date;
Windowing Functions are for
analytics of grouped rows.
Grouping can be by date/time or like
rows.
SELECT Name,
Population,
District,
x.cc
FROM city,
LATERAL (SELECT Code AS cc
FROM country
WHERE
city.CountryCode = Code) AS x
WHERE District = 'Texas'
ORDER BY name;
Lateral derived tables
for easier subqueries
WITH
cte1 AS (SELECT a, b FROM table1),
cte2 AS (SELECT c, d FROM table2)
SELECT b, d
FROM cte1
JOIN cte2 WHERE cte1.a = cte2.c;
Common Table
Expressions (CTE)
for easier subqueries
CTEs can be joined &
referenced multiple
times
3. Optimizer & Parser
1. Descending indexes
2. Optimizer trace output now includes more information about filesort operations,
such as key and payload size and why addon fields are not packed.
3. The optimizer now supports hints that enable specifying the order in which to
join tables.
4. New sys variable to include estimates for delete marked records includes delete
marked records in calculation of table and index statistics. This work was done
to overcome a problem with "wrong" statistics where an uncommitted transaction
has deleted all rows in the table.
5. NOWAIT and SKIPPED LOCKED to bypass locked records
START TRANSACTION;
SELECT * FROM seats
WHERE seat_rows.row_no BETWEEN 2 AND 3
AND booked = 'NO'
FOR UPDATE SKIP LOCKED;
...
COMMIT;
START TRANSACTION
SELECT seat_no
FROM seats JOIN seat_rows USING ( row_no )
WHERE seat_no IN (3,4) AND seat_rows.row_no IN (12)
AND booked = 'NO'
FOR UPDATE OF seats SKIP LOCKED
FOR SHARE OF seat_rows NOWAIT;
SKIPPED LOCKED
and NOWAIT mean no
waiting around for
other queries!
If the records you want
are already locked you
can search for others
CATS
The CATS algorithm is based on a simple intuition: not all
transactions are equal, and not all objects are equal.
When a transaction already has a lock on many popular
objects, it should get priority when it requests a new lock.
In other words, unblocking such a transaction will indirectly
contribute to unblocking many more transactions in the
system, which means higher throughput and lower latency
overall.
4. UTF8MB4
Previously UTF8 was actually UTF8MB3
● 3 bytes, no emojis
● Supplementary multilingual plane support limited
● No CJK Unified Ideographs Extension B are in supplementary ideographic
plane
Upgrade problem expected!
utf8mb4_0900_ai_ci:
0900 refers to Unicode Collation Algorithm version.
- ai refers to accent insensitive.
- ci refers to case insensitive.
And yes, you get all
those special *ahem*
graphics too!
5. Invisible Indexes
- An invisible index is not used by the optimizer at all, but is otherwise
maintained normally. Indexes are visible by default. Invisible indexes make
it possible to test the effect of removing an index on query performance,
without making a destructive change that must be undone should the
index turn out to be required
- ALTER TABLE t1 ALTER INDEX i_idx INVISIBLE;
- ALTER TABLE t1 ALTER INDEX i_idx VISIBLE;
6. Improved JSON Support
- JSON became a data type in MySQL 5.7
- Used for JSON formatted data, high mutable data, and reducing many to
many joins
- Many JSON functions can be be used to turn relational data into JSON
- Is the basis for the new X DevAPI and the MySQL Document Store NoSQL
- New CRUD based API
- No need to set up relations, normalize data, or build indexes
- No SQL Syntax
- Not at ORM and built on Google Protobufs
- You can specify required keys & ranges, ala JSON-Schema.org
JSON_TABLE() makes your UNstructured data temporarily structured for SQL Processing
mysql> select aaaa.name, aaaa.ordinal, aaaa.Grading FROM restaurants,
json_table(doc, "$" COLUMNS(
name char(50) path "$.name",
style varchar(50) path "$.cuisine",
NESTED PATH '$.grades[*]'
COLUMNS (
ordinal FOR ORDINALITY,
Grading char(10) path "$.grade",
Score INT path "$.score"))
)
as aaaa limit 5;
+--------------------------------+---------+---------+
| name | ordinal | Grading |
+--------------------------------+---------+---------+
| Morris Park Bake Shop | 1 | A |
| Morris Park Bake Shop | 2 | A |
| Morris Park Bake Shop | 3 | A |
| Morris Park Bake Shop | 4 | A |
| Morris Park Bake Shop | 5 | B |
JSON_TABLE() makes your structured data temporarily structured for SQL Processing
#!/usr/bin/php
<?PHP
// Connection parameters
$user = 'root'; $passwd = 'hidave'; $host = 'localhost'; $port = '33060';
$connection_uri = 'mysqlx://'.$user.':'.$passwd.'@'.$host.':'.$port;
// Connect as a Node Session
$nodeSession = mysql_xdevapigetNodeSession($connection_uri);
// "USE world_x"
$schema = $nodeSession->getSchema("world_x");
// Specify collection to use
$collection = $schema->getCollection("countryinfo");
// Query the Document Store
$result = $collection->find('_id = "USA"')->fields(['Name as Country','geography as
Geo','geography.Region'])->execute();
// Fetch/Display data
$data = $result->fetchAll();
7. Histograms
A histogram is an approximation of the data distribution for a column. It can tell you with a reasonably
accuray whether your data is skewed or not, which in turn will help the database server understand the nature
of data it contains.
Histograms comes in many different flavours, and in MySQL we have chosen to support two different types:
The “singleton” histogram and the “equi-height” histogram. Common for all histogram types is that they split
the data set into a set of “buckets”, and MySQL automatically divides the values into buckets, and will also
automatically decide what type of histogram to create.
Note that the number of buckets must be specified, and can be in the range from 1 to 1024. How many
buckets you should choose for your data set depends on several factors; how many distinct values do you
have, how skewed is your data set, how high accuracy do you need etc. However, after a certain amount of
buckets the increased accuracy is rather low. So we suggest to start at a lower number such as 32, and
increase it if you see that it doesn’t fit your needs.
That is my Top Seven!!
But I am leaving out a whole lot more!!
Some of the stuff I did not cover
InnoDB Cluster
Replica Groups
Router
Clone plug-in
MySQL Shell
speaks Python,
JS & SQL
Admin tool
Parallel Bulk
Loader
JSON/CSV
Hash Joins
Dual Passwords
zstd compression
Explain Analyze
And much more!
Thank You
Dave Stokes
Community Manager
MySQL Community Team
David.Stokes @ Oracle.com
@Stoker
ElephantDolphin. blogger.com
Copyright © 2019 Oracle and/or its affiliates.

cPanel now supports MySQL 8.0 - My Top Seven Features

  • 1.
    MySQL 8.0 NewFeatures Overview for cPanel Customers Dave Stokes Community Manager, North America MySQL Community Team Copyright © 2019 Oracle and/or its affiliates.
  • 2.
    The following isintended to outline our general product direction. It is intended for information purposes 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 upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.
  • 3.
    MySQL 8.0 NewFeatures Overview for cPanel Customers Dave Stokes Community Manager, North America MySQL Community Team Copyright © 2019 Oracle and/or its affiliates.
  • 4.
    Our Goal MySQL 8.0was a big advancement over the previous version, MySQL 5.7 and this presentation is a general overview of some of the new features. There are many new facets not covered by this presentation and hopefully you will be able to explore them later. Copyright © 2019 Oracle and/or its affiliates.
  • 5.
    MySQL 5.6 If youare using MySQL 5.6 please note that it reaches End of Life status for support and updates in February 2021. Please upgrade if you are using this version of MySQL! Copyright © 2019 Oracle and/or its affiliates.
  • 6.
    What is MySQL? •Relational Database Management System • GPLv2 licensed Community Edition • Licensed Enterprise Edition Monitoring software, improved backup, at rest encryption, data masking, db firewall, key chain management, and support • Also a NoSQL JSON Document Store Database • Also language connectors, Router, Shell, InnoDB Cluster • And more! Copyright © 2019 Oracle and/or its affiliates. 25 Years old!!
  • 7.
    What Happened toMySQL 6.0 and 7.0???? There was an early MySQL 6.0 that withered on the vine and software was included in the 5.0 series NDB Cluster has used the 7 series for many years So engineering thought we earned the 8.0 series which became generally available in April 2018
  • 8.
    My Top Seven Featuresof MySQL 8.0!
  • 9.
    1.Data Dictionary All themetadata is stored within the database itself. No more pletoria of little files under /var/lib/mysql -- saves inodes, disk space, and ‘rm accidents’. Good new: You can now have millions of tables in a schema. Bad news: You can now have millions of tables in a schema.
  • 10.
    2. Better SQL 1.Windowing Functions 2. Lateral Derived Tables 3. Common Table Expressions 4. ROW & TABLE
  • 11.
    SELECT date, amount, sum(amount) OVERw AS ‘sum’ FROM payments WINDOW w AS (ORDER BY date RANGE BETWEEN INTERVAL 1 WEEK PRECEDING AND CURRENT ROW) ORDER BY date; Windowing Functions are for analytics of grouped rows. Grouping can be by date/time or like rows.
  • 12.
    SELECT Name, Population, District, x.cc FROM city, LATERAL(SELECT Code AS cc FROM country WHERE city.CountryCode = Code) AS x WHERE District = 'Texas' ORDER BY name; Lateral derived tables for easier subqueries
  • 13.
    WITH cte1 AS (SELECTa, b FROM table1), cte2 AS (SELECT c, d FROM table2) SELECT b, d FROM cte1 JOIN cte2 WHERE cte1.a = cte2.c; Common Table Expressions (CTE) for easier subqueries CTEs can be joined & referenced multiple times
  • 14.
    3. Optimizer &Parser 1. Descending indexes 2. Optimizer trace output now includes more information about filesort operations, such as key and payload size and why addon fields are not packed. 3. The optimizer now supports hints that enable specifying the order in which to join tables. 4. New sys variable to include estimates for delete marked records includes delete marked records in calculation of table and index statistics. This work was done to overcome a problem with "wrong" statistics where an uncommitted transaction has deleted all rows in the table. 5. NOWAIT and SKIPPED LOCKED to bypass locked records
  • 15.
    START TRANSACTION; SELECT *FROM seats WHERE seat_rows.row_no BETWEEN 2 AND 3 AND booked = 'NO' FOR UPDATE SKIP LOCKED; ... COMMIT; START TRANSACTION SELECT seat_no FROM seats JOIN seat_rows USING ( row_no ) WHERE seat_no IN (3,4) AND seat_rows.row_no IN (12) AND booked = 'NO' FOR UPDATE OF seats SKIP LOCKED FOR SHARE OF seat_rows NOWAIT; SKIPPED LOCKED and NOWAIT mean no waiting around for other queries! If the records you want are already locked you can search for others
  • 16.
    CATS The CATS algorithmis based on a simple intuition: not all transactions are equal, and not all objects are equal. When a transaction already has a lock on many popular objects, it should get priority when it requests a new lock. In other words, unblocking such a transaction will indirectly contribute to unblocking many more transactions in the system, which means higher throughput and lower latency overall.
  • 17.
    4. UTF8MB4 Previously UTF8was actually UTF8MB3 ● 3 bytes, no emojis ● Supplementary multilingual plane support limited ● No CJK Unified Ideographs Extension B are in supplementary ideographic plane Upgrade problem expected! utf8mb4_0900_ai_ci: 0900 refers to Unicode Collation Algorithm version. - ai refers to accent insensitive. - ci refers to case insensitive.
  • 18.
    And yes, youget all those special *ahem* graphics too!
  • 19.
    5. Invisible Indexes -An invisible index is not used by the optimizer at all, but is otherwise maintained normally. Indexes are visible by default. Invisible indexes make it possible to test the effect of removing an index on query performance, without making a destructive change that must be undone should the index turn out to be required - ALTER TABLE t1 ALTER INDEX i_idx INVISIBLE; - ALTER TABLE t1 ALTER INDEX i_idx VISIBLE;
  • 20.
    6. Improved JSONSupport - JSON became a data type in MySQL 5.7 - Used for JSON formatted data, high mutable data, and reducing many to many joins - Many JSON functions can be be used to turn relational data into JSON - Is the basis for the new X DevAPI and the MySQL Document Store NoSQL - New CRUD based API - No need to set up relations, normalize data, or build indexes - No SQL Syntax - Not at ORM and built on Google Protobufs - You can specify required keys & ranges, ala JSON-Schema.org
  • 21.
    JSON_TABLE() makes yourUNstructured data temporarily structured for SQL Processing mysql> select aaaa.name, aaaa.ordinal, aaaa.Grading FROM restaurants, json_table(doc, "$" COLUMNS( name char(50) path "$.name", style varchar(50) path "$.cuisine", NESTED PATH '$.grades[*]' COLUMNS ( ordinal FOR ORDINALITY, Grading char(10) path "$.grade", Score INT path "$.score")) ) as aaaa limit 5; +--------------------------------+---------+---------+ | name | ordinal | Grading | +--------------------------------+---------+---------+ | Morris Park Bake Shop | 1 | A | | Morris Park Bake Shop | 2 | A | | Morris Park Bake Shop | 3 | A | | Morris Park Bake Shop | 4 | A | | Morris Park Bake Shop | 5 | B |
  • 22.
    JSON_TABLE() makes yourstructured data temporarily structured for SQL Processing #!/usr/bin/php <?PHP // Connection parameters $user = 'root'; $passwd = 'hidave'; $host = 'localhost'; $port = '33060'; $connection_uri = 'mysqlx://'.$user.':'.$passwd.'@'.$host.':'.$port; // Connect as a Node Session $nodeSession = mysql_xdevapigetNodeSession($connection_uri); // "USE world_x" $schema = $nodeSession->getSchema("world_x"); // Specify collection to use $collection = $schema->getCollection("countryinfo"); // Query the Document Store $result = $collection->find('_id = "USA"')->fields(['Name as Country','geography as Geo','geography.Region'])->execute(); // Fetch/Display data $data = $result->fetchAll();
  • 23.
    7. Histograms A histogramis an approximation of the data distribution for a column. It can tell you with a reasonably accuray whether your data is skewed or not, which in turn will help the database server understand the nature of data it contains. Histograms comes in many different flavours, and in MySQL we have chosen to support two different types: The “singleton” histogram and the “equi-height” histogram. Common for all histogram types is that they split the data set into a set of “buckets”, and MySQL automatically divides the values into buckets, and will also automatically decide what type of histogram to create. Note that the number of buckets must be specified, and can be in the range from 1 to 1024. How many buckets you should choose for your data set depends on several factors; how many distinct values do you have, how skewed is your data set, how high accuracy do you need etc. However, after a certain amount of buckets the increased accuracy is rather low. So we suggest to start at a lower number such as 32, and increase it if you see that it doesn’t fit your needs.
  • 24.
    That is myTop Seven!! But I am leaving out a whole lot more!!
  • 25.
    Some of thestuff I did not cover InnoDB Cluster Replica Groups Router Clone plug-in MySQL Shell speaks Python, JS & SQL Admin tool Parallel Bulk Loader JSON/CSV Hash Joins Dual Passwords zstd compression Explain Analyze And much more!
  • 26.
    Thank You Dave Stokes CommunityManager MySQL Community Team David.Stokes @ Oracle.com @Stoker ElephantDolphin. blogger.com Copyright © 2019 Oracle and/or its affiliates.