2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017,...

45
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 2018 中兴· 甲骨文云创日 Oracle MySQL 技术展望 Kajiyama Ryusuke ([email protected]) 马楚成 Ivan Ma ([email protected] ) 2018-01-31

Transcript of 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017,...

Page 1: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

2018 中兴·甲骨文云创日

Oracle MySQL 技术展望

Kajiyama Ryusuke ([email protected])

马楚成 Ivan Ma ([email protected])

2018-01-31

Page 2: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Safe Harbor Statement

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, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Page 3: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 3Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

MySQL的特征

存储引擎复制&集群

双重许可

3

Confidential – Oracle

Internal

SQL & NoSQL 轻量&高速Web & 移动应用&云

Page 4: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

OracleSun

MySQL发展过程

4

4.0Full textMultiple tables UPDATE/DELETEEmbedded library server

MySQL

3.23MyISAMInnoDBReplication

Before 1.0-3.22Storage engine(ISAM, HEAP)Multi-threadsWindows/64bitJapanese Characters(SJIS/UJIS)

5.0Stored proceduresStored functionCursor / Trigger / ViewXA transactionsINFORMATION_SCHEMA

4.1GIS(MyISAM)UnicodeSubquery CSV, ARCHIVEndbcluster

1995 2000 2005

・ 1995:MySQL AB established in Sweden・(2005: Oracle Acquires Innobase Oy)・ 2008:Sun Microsystems Acquires MySQL AB・ 2010:Oracle Acquires Sun Microsystems

2010 2015

Oracle

5.6 (2013-Feb GA)memcached APIUNDO tablespaceGlobal Transaction IDMulti-threads slaveOn line ALTER TABLETransportable tablespace

5.5 (2012-Dec GA)InnoDB default storage engineSemi-replicationPERFORMANCE_SCHEMA

5.7 (2015-Oct GA)New cost model optimizerLosses replicationMulti source replicationGroup replicationFull text CJK/GIS (InnoDB)Enhanced security (compliance response)NoSQL option(JSON)General TablespaceMySQL Router (HA) and more…Performance improvement

2018 -Today

5.7.17 – Group Replication5.7.18 – InnoDB Cluster5.7.19 – GR supports SAVEPOINT, more..5.7.20 – 16 Oct 2017… Audit…5.7.21 – 15 Jan 2018 TDE…

2008

Sun

5.1 (2008-Nov GA)Pluggable Storage engine · architecturePartitioningTask Scheduler

Page 5: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

MySQL NDB Cluster 发展

NDB Engine2003

………….6.2GA

Sep20076.3GA

Jan20087.0GA

April20097.1GA

April2010

7.2GA

Based on MySQL

5.5Feb2012

7.3GA –Based on MySQL

5.6June2013

7.4 GAFeb 015

7.5 GA Based on MySQL

5.7

February 2015 Copyright 2015, oracle and/or its affiliates. All rights reserved 5

最新版本: 7.5.9 (2018-01)

MySQL 7.6 .3 (DMR – 2017-07)

Page 6: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

70%到2018年,超过70%的内部应用将会使用开源的数据库进行开发

Source: Gartner, State of Relational Open Source RDBMSs 2015

Page 7: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Oracle Premier Support for MySQL

• 最大的MySQL工程及支持组织

• MySQL开发团队提供支持

• 29种语言世界级的支持

• 提供代码维护发布、修改漏洞、补丁及升级

• 24小时x365日支持

• 支持事件数量无限制

• MySQL 顾问支持

提供MySQL问题解决支持及最适合的建议

Page 8: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

MySQL Enterprise Audit

记录审计日志满足合规要求

JSON 筛选审计规则

MySQL Enterprise EncryptionMySQL的加密库

公钥 / 非对称加密

密钥管理 ( RSA, DSA, DH)

MySQL Enterprise Authentication

通过PAM/LDAP访问

原生Windows服务(AD)对访问账户集中管理。

MySQL Enterprise Firewall

防止SQL注入攻击

通过学习自动生成白名单

透明化对非正常访问进行锁定检测

以查询为单位进行保护

全面的安全合规对策(扩展功能)

MySQL Enterprise TDE保护文件系统上的数据

包括密钥管理功能(密钥保护,轮换)

Page 9: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

MySQL Support的特征

• 【性能优化】和【 SQL优化】–包括在通常的支持范围之内

–详细内容如下http://www.mysql.com/support/consultative.html

Page 10: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

Oracle MySQL Cloud Service

• 能够在Oracle Cloud里使用的开源数据库• 简单、自动化、整合&企业级• 提供基于MySQL Enterprise Edition的数据库云服务• 面向需要快速开始、高安全性、高性价比基于MySQL

的应用

Page 11: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

MySQL Cloud Service: 来自Oracle的优势

MySQL的专家提供技术支持

整合Oracle Cloud环境 云和本地的混合部署MySQL Enterprise Edition

on Oracle Cloud

企业级的运维监控解决方案

Page 12: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

满足客户的产业技术革新

13

- 提升3倍性能- 改进复制功能- 支持JSON

- 强化安全性

MySQL 5.7

MySQL InnoDB Cluster - MySQL Group Replication- MySQL Router- MySQL Shell

MySQL 8.0 (RC)- 数据字典- Roles- unicode- 通用表表达式- Window函数- 强化安全性- 改进复制功能

Page 13: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

MySQL 8.0

14

8.0.0 DMR(2016-09)

8.0.1 DMR(2017-04)

8.0.2 DMR(2017-07)

8.0.3 RC(2017-09)

8.0.4 RC(2018-01) …

Page 14: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Scalable & Stable优化集中访问,强化安全性和灾害对应

Data Driven根据应用数据分析提供运维优化

Developer First混合型的数据模型和访问API

Mobile Friendly支持包括颜文字等在内的unicode,强化对位置信息服务的支持

MySQL 8.0 : 提高Web应用的开发效率

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 15

24x7at Scale

Page 15: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 16

SELECT events.id, events.name, DATE(events.event_date) as date,ROUND(st_distance_sphere(venues.location, POINT(132.7645, 35.368377)), 2) AS distance_in_metersFROM eventsINNER JOIN venues ON events.venue_id=venues.idWHERE event_date > NOW()ORDER BY distance_in_meters;+----+---------------------+------------+---------------------+| id | name | date | distance_in_meters |+----+---------------------+------------+---------------------+| 1 | DB Study Chugoku | 2017-12-02 | 0.00 || 2 | OSC2017 Enterprise | 2017-12-09 | 628852.43 || 3 | OSC2018 Osaka | 2018-01-26 | 261242.60 |+----+---------------------+------------+---------------------+3 rows in set (0.00 sec)

Page 16: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

使用st_distance()测量距离mysql> SELECT ST_Distance_Sphere(ST_GeomFromText('POINT(139.718754 35.671148)'), ST_GeomFromText('POINT(135.492778 34.695758)')) as 'From TOKYO Office To Osaka Office';+-----------------------------------+| From TOKYO Office To Osaka Office |+-----------------------------------+| 399041.1417772843 |+-----------------------------------+

mysql> SELECT ST_Distance(ST_GeomFromText('POINT(35.671148 139.718754)', 4326), ST_GeomFromText('POINT(34.695758 135.492778)', 4326)) as 'From TOKYO Office To Osaka Office';+-----------------------------------+| From TOKYO Office To Osaka Office |+-----------------------------------+| 399801.5254154028 |+-----------------------------------+

参考: https://dev.mysql.com/doc/refman/8.0/en/spatial-analysis-functions.html 参照: Google Map

Page 17: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

utf8mb4 as default character set

• 支持最新的Unicode 9.0• 按照国别进行排序实装

18

mysql> select *,@@version from information_schema.COLLATIONS where CHARACTER_SET_NAME = 'utf8mb4' and IS_DEFAULT = 'YES';+--------------------+--------------------+----+------------+-------------+---------+------------------------------+| COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN | @@version |+--------------------+--------------------+----+------------+-------------+---------+------------------------------+| utf8mb4_general_ci | utf8mb4 | 45 | Yes | Yes | 1 | 5.7.18-enterprise-commercial |+--------------------+--------------------+----+------------+-------------+---------+------------------------------+

mysql> select *,@@version from information_schema.COLLATIONS where CHARACTER_SET_NAME = 'utf8mb4' and IS_DEFAULT = 'YES';+--------------------+--------------------+-----+------------+-------------+---------+---------------+-----------+| COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN | PAD_ATTRIBUTE | @@version |+--------------------+--------------------+-----+------------+-------------+---------+---------------+-----------+| utf8mb4_0900_ai_ci | utf8mb4 | 255 | Yes | Yes | 0 | NO PAD | 8.0.2-dmr |+--------------------+--------------------+-----+------------+-------------+---------+---------------+-----------+

MySQL 4.1

Default: Latin1

Option: utf8[mb3]

MySQL 5.5

Add: utf8mb4

MySQL 5.7

+ optimizations

MySQL 8.0

Default: utf8mb4

WL#10818: Add utf8mb4 accent sensitive and case insensitive collation https://dev.mysql.com/worklog/task/?id=10818WL#7554: Switch to new default character set and change mtr test cases https://dev.mysql.com/worklog/task/?id=7554

UNICODE详细: http://www.unicode.org/

Page 18: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 19

MySQL 8.0 vs MySQL 5.7 utf8mb4

0

45000

90000

135000

180000

8 16 64 128 512 1024

SELECT DISTINCT_RANGES010000200003000040000

8 16 64 128 512 1024

OLTP RO

07500

150002250030000

8 16 64 128 512 1024

OLTP RW

+300-350% in OLTP RO+176-233% in OLTP RW+1500-1800% in SELECT DISTINCT_RANGES

Page 19: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

MySQL 8.0 : 开发者能够更加灵活的使用

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

混合APISQL 函数数据类型

MySQL X DevAPIJSON 函数JSON 数据类型

20

SQL 和 NoSQL的CRUD混合API提供了开发的灵活性

实装了查询JSON数据的各种函数。MySQL 8.0追加了能够使用SQL对 JSON数据分析的转换函数

无缝整合了关系型表和非结构化数据。 MySQL 8.0针对更新性能进行了优化

{ } ();

Page 20: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 21

Flexible Schema

Page 21: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

【例】 JSON_TABLE()SELECT * FROM seats,JSON_TABLE(doc, "$.properties.amenities[*]" COLUMNS (id for ordinality,amenity_type VARCHAR(100) PATH "$.type",distance float PATH '$.distance_in_meters')

) AS amenitiesWHERE seats.id = 28100AND amenities.amenity_type IN ('snacks', 'bar')

ORDER BY amenities.distance;+------+------------------+------------+

| id | amenity_type | distance |

+------+------------------+------------+

| 2 | bar | 100.538 |

| 3 | snacks | 136.647 |

+------+------------------+------------+

2 rows in set (0.00 sec)

22

8.0.4 RC

Page 22: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

连接器、驱动、协议扩展功能

MySQL

Plugins

X Protocol Plugin Memcached PluginCore

MySQL Connectors and Drivers

X ProtocolStd Protocol

Memcached driver

X Protocol33060

Std Protocol3306

SQL API CRUD and SQL APIs

MemcacheProtocol

X and StdProtocols

MySQLShell

23

+-------------+----------------+--------------------+| PLUGIN_NAME | PLUGIN_VERSION | PLUGIN_DESCRIPTION |+-------------+----------------+--------------------+| mysqlx | 1.0 | X Plugin for MySQL |+-------------+----------------+--------------------+

Page 24: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

MySQL 8.0 : 提升处理数据分析效率

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Window 函数通用表表达式(CTEs)

25

• 代替子查询的导出表 (derived table)• WITH 语句• 提高分析处理 SQL的可读性和处理性能

• 用于排名等分析处理来自于用户的多数需求功能

• 对象记录和周边数据进行管理统计分析

WITH tickets_filtered AS (SELECT tickets.*, seats.docFROM tickets INNER JOIN seats ONtickets.seat_id = seats.id

WHERE tickets.event_id = 3)SELECT * FROM tickets_filteredWHERE doc->"$.section" = 201\G

SELECT name, dept_id, salary,RANK() OVER w AS `rank`FROM employeeWINDOW w AS(PARTITION BY dept_idORDER BY salary DESC);

Page 25: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

以SQL 定义 SUDOKU 题目

SELECT myproblem := '53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79' ;

26

Recursive CTE递归 CTE

Page 26: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

以递归式 CTE 解答SUDOKU难题

再拆开 9 X 9 方格

27

WITH RECURSIVEinput(sud) as ( select @myproblem ),digits(z,lp) as ( select '1', 1

union allselect cast(lp+1 as char), lp+1 from digits where lp<9 ),

x(s,ind) as ( select sud, instr(sud,'.') from inputunion allselect concat(substr(s,1, ind-1), z, substr(s, ind+1)),

instr( concat(substr(s,1,ind-1), z, substr(s, ind+1)), '.')from x, digits as zwhere ind> 0and not exists (

select 1 from digits as lpwhere z.z = substr(s, ((ind-1) div 9) *9 + lp, 1)or z.z = substr(s, ((ind-1)%9) + (lp-1) *9 + 1, 1)or z.z = substr(s, (((ind-1) div 3) %3) * 3

+ ((ind-1) div 27 ) * 27 + lp+ ((lp-1) div 3) * 6, 1)

) ),my19(n) AS (

SELECT 1 AS nUNION ALLSELECT 1+n FROM my19 WHERE n<9)

SELECT substr(s,(n-1)*9 + 1,9) as ans from x, my19 where ind=0 ;

Page 27: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 28

Page 28: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Window函数?

• Window函数是将与现在的行相关的数据集使用聚合函数进行计算

• 和聚合函数不同,可以输出多行结果

• Window函数可以访问与现在的行相关的数据行

29

聚合函数 – Group By Window函数

sum / avg …

Page 29: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Windows函数-移动平均图表

SELECT MONTH(date), SUM(sale),AVG(SUM(sale)) OVER w AS sliding_avg

FROM salesGROUP BY MONTH(date)WINDOW w AS (ORDER BY MONTH(date)

RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING);

30

vMonth = 7

Month = 7

Month = 8

Month = 8

Sum (month 8) = 250

Sum (month 7) = 1200

可读性-高!

Page 30: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Performance Schema扩展缺省取得的性能统计信息。提升Performance Schema的查询性能

隐形索引对优化器隐藏索引。实现在保留索引的前提下删除索引,分段追加

改善集中访问SELECT FOR UPDATE 文のNOWAIT や SKIP LOCKED通过参数来减少解锁等待

MySQL 8.0 : 提升应用程序性能扩展性

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 31

扩展hint语句按照SQL指定顺序进行表结合和索引合并

降序索引使用升序和降序在一起的复合索引时,由于不扫描后面的索引可以提高速度

使用hint语句更改会话变量新的hint语句SET_VAR临时更改一个SQL里的会话变量

Page 31: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

资源组通过将线程与CPU映射提升处理效率和性能

云友好的设定使用SET PERSIST 将使用SQL接口进行的变更持久化。追加了可以确认到在哪里更改了设定值的表

InnoDB专用服务器虚拟机和云环境会自动设定适合InnoDB的变量

MySQL 8.0 : 提升MySQL服务器的性能扩展性

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 32

事务调度“Contention-Aware Transaction Scheduling”作为InnoDB缺省的调度算法,性能显著提升

优化成本估算优化器支持最新的存储技术,根据数据缓存状况做出执行计划

列直方图为优化器提供没有设定索引的统计信息,改善执行计划

Page 32: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

设定的持久化

• 使用以下的语句将更改的系统变量持久化– SET PERSIST max_connections = 500;

– SET PERSIST_ONLY innodb_log_file_size = 128*1024*1024;

• 无需访问文件系统更改系统变量

• 追加了确认信息,包括时间、用户等

33

mysql> SET PERSIST log_timestamps='SYSTEM';Query OK, 0 rows affected (0.00 sec)

mysql> select * from performance_schema.variables_info where variable_source='PERSISTED';+----------------+-----------------+--------------------------------+-----------+-----------+---------------------+----------+-----------+| VARIABLE_NAME | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE | SET_TIME | SET_USER | SET_HOST |+----------------+-----------------+--------------------------------+-----------+-----------+---------------------+----------+-----------+| log_timestamps | PERSISTED | /var/lib/mysql/mysqld-auto.cnf | 0 | 0 | 2017-10-14 14:48:28 | root | localhost |+----------------+-----------------+--------------------------------+-----------+-----------+---------------------+----------+-----------+

WL#8688: Support ability to persist SET GLOBAL settingshttps://dev.mysql.com/worklog/task/?id=8688

#cat /var/lib/mysql/mysqld-auto.cnf{ "mysql_server": {"log_timestamps": "SYSTEM" } }

Page 33: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

资源组shell> cat /proc/cpuinfo | grep processorprocessor : 0processor : 1

mysql> CREATE RESOURCE GROUP CPU1 TYPE=USER VCPU=1; Query OK, 0 rows affected (0.24 sec)

mysql> SELECT * from INFORMATION_SCHEMA.RESOURCE_GROUPS;+---------------------+---------------------+------------------------+----------+-----------------+| RESOURCE_GROUP_NAME | RESOURCE_GROUP_TYPE | RESOURCE_GROUP_ENABLED | VCPU_IDS | THREAD_PRIORITY |+---------------------+---------------------+------------------------+----------+-----------------+| USR_default | USER | 1 | 0-1 | 0 || SYS_default | SYSTEM | 1 | 0-1 | 0 || CPU0 | USER | 1 | 0 | 0 || CPU1 | USER | 1 | 1 | 0 |+---------------------+---------------------+------------------------+----------+-----------------+4 rows in set (0.00 sec)

mysql> SET RESOURCE GROUP CPU0;select "This user connection will use Processor 0 Only";

mysql> SELECT /*+ RESOURCE_GROUP(CPU0) */ "This user connection will use Processor 0 Only";

34

使用资源组,可以控制资源,有效或者限制线程的资源使用。DBA可以根据工作量来更改这些属性。

WL#9467: Resource Groupshttps://dev.mysql.com/worklog/task/?id=9467

Page 34: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

增强安全性

追加了角色 & Dynamic Privileges 。扩展了透明数据加密

数据字典

使用InnoDB管理元数据。提高元数据的一致性和信赖性

MySQL InnoDB Cluster

MySQL 标准的高可用性套件。自动进行故障转移、恢复和冲突检测

MySQL 8.0 : 增强应用的安全性和可用性

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 35

Page 35: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 36

扩展High Performance

易用Built-in HA

整体解决方案Everything Integrated

MySQL

InnoDBcluster

Page 36: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

MySQL Connector

Application

MySQL Router

MySQL Connector

Application

MySQL Router

MySQL Shell

MySQL Connector

Application

MySQL Router

MySQL Connector

Application

MySQL Router

MySQLInnoDB

clusterMySQL Enterprise Monitor

mysql-js> cluster.status(){"clusterName": “NewAppCluster","defaultReplicaSet": {

"status": "Cluster tolerant to up to ONE failure.","topology": {

“hanode1:3306": {"address": “hanode1:3306","status": "ONLINE","role": "HA","mode": "R/W",

MySQL InnoDB Cluster: 整体架构

37

Page 37: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 38

未来的扩展功能

MySQL HA

Out-Of-Box HA

Read Scale-Out

Async Replication + Auto Failover

Write Scale-Out

ShardingStep1

Step2

Step3

* InnoDB Cluster Now GA!

Page 38: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

S1 S2 S3 S4 S…

M

M M

MySQL Connector

Application

MySQL Router

MySQL Connector

Application

MySQL Router

MySQL Shell

HA

Group Replication

Read-Only Slaves

39

可以连接Group Replication的从服务器+当连接的服务器宕机时,自动从群组中选择其他成员连接

MySQL InnoDB Cluster: Architecture – Step 2

Page 39: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

S1 S2 S3 S4 S…

M

M M

MySQL Connector

Application

MySQL Router

MySQL Connector

Application

MySQL Router

MySQL Shell

HA

Rep

licaS

et1

S1 S2 S3 S4 S…

M

M M

MySQL Connector

Application

MySQL Router

HA

Rep

licaS

et 2

Rep

licaS

et 3

MySQL Connector

Application

MySQL Router

S1 S2 S3 S4

M

M M

HA

40

通过分组实现数据写入分片

MySQL InnoDB Cluster: Architecture – Step 3

Page 40: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Transactional Data Dictionary

• 提升信赖性

• 在InnoDB内部保存数据字典

– No FRM files

– No DB.OPT files

– No TRG files

– No TRN files

– No PAR files

• 不包括MyISAM

41

WL#6379: Schema definitions for new DD https://dev.mysql.com/worklog/task/?id=6379WL#6392: Upgrade to Transactional Data Dictionaryhttps://dev.mysql.com/worklog/task/?id=6392WL#6394: Bootstrap code for new DD https://dev.mysql.com/worklog/task/?id=6394 and more

[root@DockerHost oracle]# ls -l /docker/docker802/worldtotal 1084-rw-r----- 1 27 27 638976 Jul 18 01:25 city.ibd-rw-r----- 1 27 27 196608 Jul 18 01:25 country.ibd-rw-r----- 1 27 27 262144 Jul 18 01:25 countrylanguage.ibd

8.0SQ

LSQ

L

8.0

5.7

Page 41: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

MySQL 8.0 : 增强安全性

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 42

实装SQL角色Easier to manage user and

applications rights and SQL standard compliant

原子性更改元数据New InnoDB based data dictionary

enables ACL statements atomic and reliable

Dynamic PrivilegesProvides finer grained

administrative level access controls for less use of root user

透明化加密日志文件AES 256 encryption of REDO, UNDO and Binary Log in addition to tablespacefiles

增强密码管理Establish password-reuse policy with Password History, and faster with caching

Page 42: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

InnoDB Redo/Undo 加密• Redo/Undo日志写盘时加密

– 使用系统变量 innodb_redo_log_encrypt, innodb_undo_log_encrypt 来控制

43

WL#9289: InnoDB: Support Transparent Data Encryption for Undo Tablespaceshttps://dev.mysql.com/worklog/task/?id=9289WL#9290: InnoDB: Support Transparent Data Encryption for Redo Log https://dev.mysql.com/worklog/task/?id=9290

REDO

UNDO MySQL 8.0

Page 43: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

总结 / 参考

• MySQL 8.0 展望–功能更多,更强,更安全,更稳定, 性能更好

• GIS, 递归CTE, TDE, InnODB Cluster,

• JSON,Collection,等等

• 网页参考

• MySQL 8.0.4 RC – 可以下载 - https://dev.mysql.com/downloads/mysql/8.0.html

• https://mysqlserverteam.com/the-mysql-8-0-4-release-candidate-is-available/

• https://www.mysql.com/cloud/

• https://dev.mysql.com/doc/

• https://www.mysql.com/products/enterprise/demo.html

• https://dev.mysql.com/

• https://www.mysql.com/downloads/

• https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-4.html

44

Page 44: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |

Page 45: 2018 中兴 甲骨文云创日 Oracle MySQL 技术展望 · Copyright © Copyright © 2017, 2017,Oracle and/or its affiliates. All rights reserved. Oracle and/or its affiliates. All