MySQL 8.0.1 DMR
-
Upload
mysql-brasil -
Category
Technology
-
view
434 -
download
2
Transcript of MySQL 8.0.1 DMR
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
MySQL 8.0 Development Milestone Releases 8.0.0 e 8.0.1
Oracle Confidential – Internal/Restricted/Highly Restricted
Airton Lastori Consultor MySQL [email protected] jun-17
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
MySQL Innovation: 5.7 -> 8.0
- 3x Better Performance - Replication Enhancements - Optimizer Cost Model - JSON Support - Improved Security - Sys & Performance Schema - GIS
MySQL 5.7 (GA)
MySQL InnoDB Cluster (GA) - MySQL Group Replication - MySQL Router - MySQL Shell
MySQL 8.0 (DMR) - Data Dictionary - Roles - Unicode - CTEs - Window Functions - Security - Replication - SysSchema - GIS
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
“The demand for database administrators and developers is much higher than the current supply, as well, leading to lots of open positions.”
https://stackoverflow.blog/2017/03/09/developer-hiring-trends-2017/
Oracle Confidential – Internal/Restricted/Highly Restricted 3
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
MySQL 5.7 – Improvements across the board
• Replication
• InnoDB
• Optimizer
• Security
• Performance Schema
• GIS
• Triggers
• Partitioning
• New! SYS Schema
• New! JSON
• Performance
4
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. | 5
MySQL InnoDB Cluster: Vision
“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 © 2017 Oracle and/or its affiliates. All rights reserved. |
Principais features até DMR 8.0.1
1. Data Dictionary
2. Cloud-friendly Operations
3. Roles
4. CTEs
5. Window Functions
6. More for Developers
7. GIS
8. Security
9. Replication
10.InnoDB Cluster Goals
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
1. Transactional Data Dictionary
• Increased Reliability
• Using InnoDB internally for data dictionary
– No FRM files
– No DB.OPT files
– No TRG files
– No TRN files
– No PAR files
• MySQL 8.0 default install no longer contains MyISAM tables.
7
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
1. Transactional Data Dictionary
• Better cross-platform experience
– No dependencies on filesystem semantics
• Atomic DDL
– Better Replication
– Simplifies server edge cases
• MDL for Foreign Keys
• Flexible Metadata API
– Easier path to adding new features
8
Additional Benefits
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
2. Persist Configuration
• Persist GLOBAL Server Variables – SET PERSIST max_connections = 500;
• Examples Include:
– Offline_mode
– Read_Only
• Requires no filesystem access
• New! Includes timestamp and change user
9
Cloud Friendly
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
2. Variables Info
10
Find the source of variables changed on your installation
SELECT * FROM performance_schema.variables_info WHERE variable_source != 'COMPILED';
+------------------------+-----------------+--------------------+-----------+-----------+---------------------+----------+-----------+
| VARIABLE_NAME | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE | SET_TIME | SET_USER | SET_HOST |
+------------------------+-----------------+--------------------+-----------+-----------+---------------------+----------+-----------+
| autocommit | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
| basedir | COMMAND_LINE | | 0 | 0 | 2017-04-16 21:08:11 | | |
| bind_address | EXPLICIT | [..]my.sandbox.cnf | 0 | 0 | 2017-04-16 21:08:11 | | |
| character_set_client | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
| character_set_results | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
| collation_connection | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
| datadir | COMMAND_LINE | | 0 | 0 | 2017-04-16 21:08:11 | | |
| foreign_key_checks | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
| log_error | COMMAND_LINE | | 0 | 0 | 2017-04-16 21:08:11 | | |
| lower_case_table_names | EXPLICIT | [..]my.sandbox.cnf | 0 | 2 | 2017-04-16 21:08:11 | | |
| pid_file | COMMAND_LINE | | 0 | 0 | 2017-04-16 21:08:11 | | |
| plugin_dir | COMMAND_LINE | | 0 | 0 | 2017-04-16 21:08:11 | | |
| port | COMMAND_LINE | | 0 | 65535 | 2017-04-16 21:08:11 | | |
| socket | COMMAND_LINE | | 0 | 0 | 2017-04-16 21:08:11 | | |
| sql_mode | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
| sql_notes | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
| time_zone | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
| tmpdir | EXPLICIT | [..]my.sandbox.cnf | 0 | 0 | 2017-04-16 21:08:11 | | |
| unique_checks | DYNAMIC | | 0 | 0 | 2017-04-16 20:56:53 | msandbox | localhost |
+------------------------+-----------------+--------------------+-----------+-----------+---------------------+----------+-----------+
19 rows in set (0.00 sec)
Cloud Friendly
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
3. MySQL Roles
Improving MySQL Access Controls
• Easier to manage user and applications rights
• As standards compliant as practically possible
• Multiple default roles
• Can export the role graph in GraphML
11
Feature Request from DBAs
Directly
Indirectly
Set Role(s)
Default Role(s) Set of ACLS
Set of ACLS
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
4. Common Table Expressions
• “With queries”
• Both Recursive and Non-Recursive Forms
• Simplifies writing complex SQL: WITH t1 AS (SELECT * FROM tblA WHERE a=‘b’)
SELECT * FROM t1;
12
Feature Request from Developers
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
4. Recursive CTE
• A recursive CTE refers to itself in a subquery
• The “seed” SELECT is executed once to create the initial data subset, the recursive SELECT is repeatedly executed to return subsets of data until the complete result set is obtained.
• Useful to dig in hierarchies (parent/child, part/subpart)
• Similar to Oracle's CONNECT BY
13
WITH RECURSIVE cte AS ( SELECT ... FROM table_name /* "seed" SELECT */ UNION ALL SELECT ... FROM cte, table_name) /* "recursive" SELECT */ SELECT ... FROM cte;/
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. | 14
Print 1 to 10
4. Recursive CTE (Example)
a
1
2
3
4
5
6
7
8
9
10
WITH RECURSIVE qn AS
( SELECT 1 AS a
UNION ALL
SELECT 1+a FROM qn WHERE a<10
)
SELECT * FROM qn;
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
5. Window Functions
15
Feature Request from Developers
SELECT name, department_id, salary,
SUM(salary)
OVER (PARTITION BY department_id)
AS department_total
FROM employee
ORDER BY department_id, name;
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
6. utfmb4 as default character set
• Support for the latest Unicode 9.0
• Accent and case sensitive collations
• Language specific collations
• including Japanese
• Performance Optimization
16
+300-350% in OLTP RO +176-233% in OLTP RW +1500-1800% in SELECT DISTINCT_RANGES
Feature Request from Developers
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
6. Continuing the JSON Developer Experience
• MySQL Document Store
– Document collections
– Relational tables
– Combine them as you like
• Administer MySQL via the MySQL Shell
– One stop DevOps tool for MySQL
– Out of the Box HA
– Use your preferred language: SQL, JavaScript, Python, …
– Relational or Document
17
Feature Request from Developers
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
6. UUID and Bit-wise Improvements
• Functions to convert UUID to and from binary:
– UUID_TO_BIN()
– BIN_TO_UUID()
– plus IS_UUID()
• Bit-wise operations on binary data types
• Bit-wise operations on binary data types
– Designed with IPv6 in mind:
– INET6_ATON(address) & INET6_ATON(network)
18
Feature Request from Developers
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
6. UUID_TO_BIN Optimization
19
24.75 25.5 26.25 27. 27.75 28.5 29.25
Insert Performance Optimized Original
• Binary format is now smaller and insert-order efficient:
11e678fe53303f87a4778c89a52c4f3b
53303f87-78fe-11e6-a477-8c89a52c4f3b From VARCHAR(36)
To VARBINARY(16)
Feature Request from Developers
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
6. MySQL 8.0: Better Handing of Hot Rows
20
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;
Non deterministically skip over locked rows
Error immediately if a row is already locked
Feature Request from Developers
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
7. GIS
• Geography support
• st_distance()
• Spatial Reference Systems (SRS) Support
• SQL/MM Information Schema views
• Standard compliant axis ordering in import/export functions
• Helper functions to manipulate and convert data:
• st_x(geom, x)
• st_y(geom, y)
• st_srid(geom, srid)
21
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
9. MySQL 8.0 Parallel Replication
22
Production Workload #1
Production Workload #2
4x Improvement on single-threaded!
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
• One Product: MySQL
– All components created together
– Tested together
– Packaged together
• Easy to Use
– One client: MySQL Shell
– Easy packaging
– Integrated orchestration
– Homogenous servers
• Flexible and Modern – SQL and NoSQL together
– Protocol Buffers
– Asynchronous API
– Developer friendly
• Support Read/Write Scale Out – Sharded clusters
– Federated system of N replica sets • Supporting cross shard operations
– Each replica set manages a shard
23
10. MySQL InnoDB Cluster Goals
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
All these features plus… • Source code now documented with
Doxygen
• Plugin Infrastructure!
• Expanded GIS Support
• Expanded Query Hints Support
• Improved Scan Query Performance
• Improved BLOB Storage
• Improved Memcached Interface
• Cost Model Improvements
• Scalability Improvements
• Atomicity in Privileges
• Parser Refactoring
• Improvements to Temporary Tables
• C++11 and Toolchain Improvements
• GTID_PURGED always settable
• Persistent Auto Increment
• Native InnoDB Data dictionary
• Improved Information Schema performance
• New! SQL Grouping Function
• New! Optimizer Trace detailed sort statistics
• New! Descending Indexes
• New! Smaller Package Downloads
• New! JSON Aggregate, Pretty print functions
• New! JSON performance improvements
• New! Expanded Query Hints
• New! Improved usability of cost constant configuration
• Group Replication in 8.0
• New! Transaction Save Point support in Group Replication
• New! Improved Replication Applier Lag Statistics in Performance Schema
• New! Per Multi-source Channel Replication Filters
• New! Atomic DDL extended to the Binary Log
• New! Performance Improvements on the Replication Applier
• New! Parallel Replication Applier Policy
• New! Binary Log Management Enhancements
• New! Additional Metadata Into the Binary Log
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. |
Referências
Oracle Confidential – Internal/Restricted/Highly Restricted 25
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 26
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 27
Copyright © 2017 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 28
Oracle Confidential – Internal/Restricted/Highly Restricted 30