未加星标

What MySQL 8.0.1 means to you as a Developer

字体大小 | |
[数据库(mysql) 所属分类 数据库(mysql) | 发布者 店小二03 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏
This post will be updated as soon more information comes along.

This developer version wasn’t released yet, when it does, use at your own risk.

Oracle released the development version of mysql 8.0.0-dmr on September 12th of 2016. Since then, the team have been working on the 8.0.1 development milestone. You can find the complete change list here .

The objective here is try to explain how this will have any real world impact for you from 8.0.1. Please reember though, that any changes made to this version will not be final until the General Availability (date not currently set).

These topics are aimed at the Software Engineering side and not DBA and this is why Replication , for instance, is not covered here.

Changes Charset and Collation

MySQL 8.0 was defined as to have utf8mb4 as the default CHARACTER SET and utf8mb4_general_ci as the default COLLATION . 8.0.1 will change the default COLLATION to utf8mb4_0900_ai_ci .

Let’s analyse the name utf8mb4_0900_ai_ci :

0900 refers to Unicode Collation Algorithm version. ai refers to accent insensitive. ci refers to case insensitive.

How does that impact you? It means that by default, new tables will have that collation and will be able to handle more characters than Basic Multilingual Plane (more emoji! ♀), plus it will be accent and case insensitive. If you want case and accent sensitive you will need to use utf8mb4_0900_as_cs .

Language Specific Charsets

There are cases where language takes precedence over the default general collation. For this you will need to use, for example in the instance of German phone book order, utf8mb4_de_pb_0900_as_cs .

Optimization Descending Index

This particularly is one of my most desired features. Finally being implemented on this version, the ALTER TABLE ADD INDEX ix_column (column DESC) won’t be parsed as ASC anymore.

Since InnoDB uses BTREE indexes, when running a query that uses it in the case of single columns it doesn’t matter if the index is ASC or DESC . The index is used for DESC anyway.

However when working with multi-column indexes this will matter and having a descending index will actually increase your performance. Example:

A generic table users :

Field Type Null Key Default Extra id int(10) unsigned NO PRI auto_increment first_name varchar(127) NO last_name varchar(128) NO email varchar(255) NO created_at timestamp NO CURRENT_TIMESTAMP updated_at timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP

The following query will have better performance if run with DESC index on updated_at time column:

SELECT * FROM `users` ORDER BY updated_at DESC, first_name ASC LIMIT 100;

For that we need the following index:

ALTER TABLE `users` ADD INDEX `ix_updated_at_first_name` (updated_at DESC, first_name ASC);

Before that, the query plan would do a full scan on the table and not use the index at all. After the index is created it searches on index, and not the table:

Before After
What MySQL 8.0.1 means to you as a Developer
What MySQL 8.0.1 means to you as a Developer

The query above is just a simplistic example and doesn’t filter anywhere the index, this is why it causes to do a full index scan.

Parser

I personally never made use for \N to indicate NULL in any query itself, but I have used it in CSV or TSV files.

This behaviour won’t be supported anymore.

This change won’t impact file import or export through LOAD DATA INFILE or SELECT ... INTO OUTFILE .

Functionalities In-place operations

In MySQL 5.7 theGenerated Columns feature was added. However ALTER TABLE in tables containing one would be a COPY operation (which is slower since it has to copy all data again of the table). Now it can be INPLACE as long as the column(s) being modified is not in a generated column. What this actually means is: the metadata for the column will be changed in real time, without the need to internally create a new table and copy data.

JSON Features

Two new functions are added to aggregate JSON values: JSON_ARRAYAGG() and JSON_OBJECTAGG() .

JSON_ARRAYAGG() takes a column or expression as an argument and aggregates the result in a single JSON array.

With JSON_OBJECTAGG(id, col) you can use two columns which will be interpreted as key and value and returns a single JSON object.

Performance

Performance on JSON columns when used with ORDER BY was improved. Before MySQL would allocate 1K of memory to a sort key, making it fixed length. The extra padding was removed in this version.

Error Handling

The indexing of JSON fields is only possible through Generated Columns. If you tried to index a JSON field before, would get the following as an error:

JSON column '%s' cannot be used in key specification.

The error message has now been made clearer:

JSON column '%s' supports indexing only via generated columns on a specified JSON path. Bugs

More than 100 bugs were fixed on this version. It ranges from InnoDB through Replication and even compilation bugs. The list is too big to be tacked on to this article, but the complete change list is available here .

本文数据库(mysql)相关术语:navicat for mysql mysql workbench mysql数据库 mysql 存储过程 mysql安装图解 mysql教程 mysql 管理工具

主题: MySQLSQLInnoDBTICUUT
分页:12
转载请注明
本文标题:What MySQL 8.0.1 means to you as a Developer
本站链接:http://www.codesec.net/view/524074.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(mysql) | 评论(0) | 阅读(130)