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 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)

When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

Difference between clustered index and non-clustered index (secondary index) in InnoDB. Difference between clustered index and non-clustered index (secondary index) in InnoDB. Apr 02, 2025 pm 06:25 PM

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values ​​and pointers to data rows, and is suitable for non-primary key column queries.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

The relationship between mysql user and database The relationship between mysql user and database Apr 08, 2025 pm 07:15 PM

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

Can mysql and mariadb coexist Can mysql and mariadb coexist Apr 08, 2025 pm 02:27 PM

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

Explain different types of MySQL indexes (B-Tree, Hash, Full-text, Spatial). Explain different types of MySQL indexes (B-Tree, Hash, Full-text, Spatial). Apr 02, 2025 pm 07:05 PM

MySQL supports four index types: B-Tree, Hash, Full-text, and Spatial. 1.B-Tree index is suitable for equal value search, range query and sorting. 2. Hash index is suitable for equal value searches, but does not support range query and sorting. 3. Full-text index is used for full-text search and is suitable for processing large amounts of text data. 4. Spatial index is used for geospatial data query and is suitable for GIS applications.

See all articles