Home Database Mysql Tutorial mysql8.0 is coming

mysql8.0 is coming

Feb 07, 2017 pm 04:33 PM

MySQL is an open source small relational database management system, developed by the Swedish MySQL AB company. Currently, MySQL is widely used in small and medium-sized websites on the Internet. Due to its small size, fast speed, low total cost of ownership, and especially the characteristics of open source, many small and medium-sized websites choose MySQL as their website database in order to reduce the total cost of website ownership.

The MySQL development team announced the release of MySQL 8.0.0 development milestone version (DMR) on the 12th! Some people may be surprised why MySQL jumped from 5.x to 8.0. In fact, the MySQL 5.x series has lasted for many years. It was 5.1 before the acquisition by Oracle, and has been maintained at 5.x since the acquisition, such as 5.5, 5.6, 5.7 and so on. In fact, if you follow the original release rhythm, you can think of 5.6.x as 6.x and 5.7.x as 7.x. Therefore, we just changed the version naming method.

mysql8.0 is coming

However, the MySQL 8.0.0 development version released this time still has many highlights.

Highlights of MySQL 8.0.0

Transactional data dictionary, completely separated from the MyISAM storage engine

Really put the data dictionary into some tables in InnoDB, no longer FRM, TRG, PAR files are needed! Information Schema now appears as a view of the data dictionary tables. In principle, there is no need for the MyISAM data table type at all, and all system tables can be placed in InnoDB.

SQL Role

A role is a collection of permissions. You can create roles, grant and remove roles to a user. This is convenient for permission management.

utf8mb4 character set will become the default character set and support Unicode 9

The default character set will be changed from latin1 to utf8mb4, and the default ordering collation will be changed from latin1_swedish_ci to utf8mb4_800_ci_ai.

Invisible indexes

You can set some indexes to be invisible so that the SQL optimizer will not use it, but it will continue to be updated in the background. Visibility can be restored at any time when needed.

Bit operations can be performed on binary data

Not only can bit operations be performed on BIGINT, but also supports bit operations on [VAR]BINARY/[TINY|MEDIUM|LONG]BLOB starting from 8.0 .

Improved operations on IPv6 and UUID

INET6_ATON() and INET6_NTOA() can now perform bit operations, because INET6_ATON() now returns the VARBINARY(16) data type (128 Bit). UUID operations have been improved, and three new functions UUID_TO_BIN(), BIN_TO_UUID() and IS_UUID() have been introduced. MySQL does not have special IPv6 and UUID data types, but is stored in the VARBINARY(16) data type.

Persistent global variables

You can use SET PERSIST to set persistent global variables, which will remain even if the server is restarted.

Improvements in Performance Schema of Performance Database

For example, more than 100 indexes have been added to the performance database to enable faster retrieval.

Reconstruct the SQL analyzer

Continuously and gradually improve the SQL analyzer. The old parser had severe limitations due to its syntactic complexity and top-down parsing approach, making it difficult to maintain and extend.

Cost Model

InnoDB buffers can now estimate how many tables and indexes are in the main memory cache. This allows the optimizer to know whether the data can be stored in memory or not when choosing an access method. Must be stored on disk.

Histograms

By using histograms, users or DBAs can make statistics on data distribution, which can be used for query optimization to find optimized query solutions.

Improve scanning performance

Improved the performance of InnoDB range query, which can improve the performance of full table query and range query by 5-20%.

Reconstructing BLOB

Reconstructing BLOB speeds up fragment read/update operations and can speed up JSON data operations.

Persistent auto-increment value

InnoDB will persist the maximum value of the auto-increment sequence to the redo log. This improvement also fixes a very old bug number 199.

Temporary table

Cancel support for compressed temporary tables and store the metadata of temporary tables in memory.

For more important improvements and details, please refer to the MySQL 8.0.0 release announcement [1] and here [2].

Download

Currently 8.0.0 is still a development version. If you want to experience and test the latest features, you can download the installation packages for each platform from dev.mysql.com[3]. However, the MySQL software package is getting larger and larger, and the binary package on the Linux platform is nearly 1 GB. If used in a production environment, please continue to use the 5.7 series before 8.0 enters the stable version. The latest version is the 5.7.15 GA version - which is only more than 600 M.

The latest source code is placed on GitHub. Interested friends can check it out. Many of them are contributions from Chinese people.

Starting from MySQL8.0, the hidden index feature is supported, which is the so-called invisible index. For invisible indexes, the optimizer will simply ignore them. We can influence the behavior of the optimizer through this feature. In addition, this can also be regarded as a buffer before dropping an index. After temporarily setting the index to be invisible, then observe whether the application is normal or if there is an error or something. If everything is OK, then delete it finally.

Corresponding release note of 8.0.0:

mysql8.0 is coming

Test

# 创建一个普通的表t1,只带主键
mysql> create table t1 (a int primary key auto_increment, b int, c int, d int);
Query OK, 0 rows affected (0.67 sec)
# 增加一个索引
mysql> alter table t1 add key(b);
Query OK, 0 rows affected (0.06 sec)
Records: 0  Duplicates: 0  Warnings: 0
mysql> show indexes from t1\G
*************************** 1. row ***************************
        Table: t1
   Non_unique: 0
     Key_name: PRIMARY
 Seq_in_index: 1
  Column_name: a
    Collation: A
  Cardinality: 0
     Sub_part: NULL
       Packed: NULL
         Null:
   Index_type: BTREE
      Comment:
Index_comment:
      Visible: YES
*************************** 2. row ***************************
        Table: t1
   Non_unique: 1
     Key_name: b
 Seq_in_index: 1
  Column_name: b
    Collation: A
  Cardinality: 0
     Sub_part: NULL
       Packed: NULL
         Null: YES
   Index_type: BTREE
      Comment:
Index_comment:
      Visible: YES
2 rows in set (0.01 sec)
从show indexes的visible列显示了,这两个索引都是可见的。
# Load some data
insert into t1 select NULL, rand()*100000, rand()*10000,rand()*10000;
insert into t1 select NULL, rand()*100000, rand()*10000,rand()*10000 from t1;
insert into t1 select NULL, rand()*100000, rand()*10000,rand()*10000 from t1;
....
analyze table t1;
mysql> explain select * from t1 where b > 5000 limit 10;
+----+-------------+-------+------------+-------+---------------+------+---------+------+------+----------+-----------------------+
| id | select_type | table | partitions | type  | possible_keys | key  | key_len | ref  | rows | filtered | Extra            |
+----+-------------+-------+------------+-------+---------------+------+---------+------+------+----------+-----------------------+
|  1 | SIMPLE     | t1   | NULL     | range | b         | b   | 5     | NULL | 1932 |   100.00| Using index condition |
+----+-------------+-------+------------+-------+---------------+------+---------+------+------+----------+-----------------------+
1 row in set, 1 warning (0.00 sec
可以看到索引b被使用到
# 修改索引b为不可见
mysql> alter table t1 alter index b invisible;
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0
mysql> show indexes from t1\G
*************************** 1. row ***************************
        Table: t1
   Non_unique: 0
     Key_name: PRIMARY
 Seq_in_index: 1
  Column_name: a
    Collation: A
  Cardinality: 2048
     Sub_part: NULL
       Packed: NULL
         Null:
   Index_type: BTREE
      Comment:
Index_comment:
      Visible: YES
*************************** 2. row ***************************
        Table: t1
   Non_unique: 1
     Key_name: b
 Seq_in_index: 1
  Column_name: b
    Collation: A
  Cardinality: 2029
     Sub_part: NULL
       Packed: NULL
         Null: YES
   Index_type: BTREE
      Comment:
Index_comment:
      Visible: NO
2 rows in set (0.01 sec)
mysql> explain select * from t1 where b > 5000 limit 10\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: t1
   partitions: NULL
         type: ALL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 2048
     filtered: 33.33
        Extra: Using where
1 row in set, 1 warning (0.00 sec)
当索引被修改为invisible后,优化器将不再选择这个索引
# 将索引重新修改为可见
mysql> alter table t1 alter index b visible;
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0
mysql> explain select * from t1 where b > 5000 limit 10\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: t1
   partitions: NULL
         type: range
possible_keys: b
          key: b
      key_len: 5
          ref: NULL
         rows: 1932
     filtered: 100.00
        Extra: Using index condition
1 row in set, 1 warning (0.00 sec)
# 你也可以在创建索引的时候显式指定是否可见
mysql> alter table t1 add key(c) invisible;
Query OK, 0 rows affected (0.12 sec)
Records: 0  Duplicates: 0  Warnings: 0
mysql> show indexes from t1 where key_name = 'c'\G
*************************** 1. row ***************************
        Table: t1
   Non_unique: 1
     Key_name: c
 Seq_in_index: 1
  Column_name: c
    Collation: A
  Cardinality: 1848
     Sub_part: NULL
       Packed: NULL
         Null: YES
   Index_type: BTREE
      Comment:
Index_comment:
      Visible: NO
1 row in set (0.01 sec)
# 或者在建表时指定关键字
mysql> create table t2 (a int primary key, b int, key(b) invisible);
Query OK, 0 rows affected (0.67 sec)
# 但primary key不可以设置为不可见
mysql> drop table t2;
Query OK, 0 rows affected (0.03 sec)
mysql> create table t2 (a int, b int, primary key(a) invisible);
ERROR 3522 (HY000): A primary key index cannot be invisible
Copy after login


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1672
14
PHP Tutorial
1276
29
C# Tutorial
1256
24
MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Explain the role of InnoDB redo logs and undo logs. Explain the role of InnoDB redo logs and undo logs. Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

How does MySQL index cardinality affect query performance? How does MySQL index cardinality affect query performance? Apr 14, 2025 am 12:18 AM

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

MySQL for Beginners: Getting Started with Database Management MySQL for Beginners: Getting Started with Database Management Apr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

Explain the InnoDB Buffer Pool and its importance for performance. Explain the InnoDB Buffer Pool and its importance for performance. Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

MySQL: Structured Data and Relational Databases MySQL: Structured Data and Relational Databases Apr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

See all articles