Mysql5.5 and 5.6 and the connection and difference with 5.7

Mysql5.5 features, relative to Mysql5.1
performance improvement

The default InnoDB plugin engine. With submission, rollback and crash recovery functions, ACID compatible.

Row-level locks (consistent non-locking read MVCC).

Tables and indexes are stored in the table space, and the table size is unlimited.

Support dynamic (primary key cache memory to avoid IO caused by primary key query) and compressed (support data and index compression) row formats.

InnoDB plugin file format Barracuda, supports table compression, saves storage, provides memory hit rate, and truncate table is faster.

The original InnoDB has only one UndoSegment, which supports up to 1023 concurrency; now there are 128 Segments, which supports 128K concurrency (similarly, it solves the transaction rollback caused by high concurrency).

Innodb_thread_concurrency is 0 by default, and the number of threads concurrency is unlimited, and the best value can be set according to the specific application.

Innodb_io_capacity can dynamically adjust the number of dirty pages refreshed to improve the performance degradation caused by the failure of refreshing dirty pages to keep up with large batch updates. Default: 200, which is related to the IOPS of the hard disk.

Make full use of the CPU multi-core processing capabilities innodb_read_io_threads threshold: 1-64 innodb_write_io_threads threshold: 1-64 flexibly set according to the read-write ratio of the database, give full play to the performance of multi-CPU, high-performance storage devices, does not support dynamic loading.

Refresh dirty pages adaptively

Hot data survives longer

Buffer pool multi-instance: The innodb_buffer_pool_instances parameter increases the number of innodb_buffer_pool instances, which greatly reduces the mutex contention overheating of the buffer pool.

Asynchronous IO on Linux

Re-support group submission

Stability improvement

Support semi-synchronous Replication.

Increase the Relay Log self-repair function.

Crash recovery。

Introducing the red-black tree as the intermediate data structure of insertion sort, the time complexity is greatly reduced, and the recovery time is reduced.

Thread Pool packet queuing current limit

Mysql5.6 features, compared to 5.5

Change of default parameters

Back_log queue

Support full-text index

支持online DDL create,alter,drop

You can specify the location of the table space when building the table

create table external (x int unsigned not null primary key)data directory = ‘/volumes/external1/data’;

New parameter innodb_page_size can set the page size

Integrate the memcached API, you can use the API to directly access the innodb table, not SQL (reducing the cost of SQL parsing and query optimization)

Innodb read-only transaction, there is no need to set the TRX_ID field,

Reduce internal data structure overhead and reduce read view

Only non-read-only transactions still require TRX_ID

Innodb improvement points

Innodb tablespace online migration (TransportableTablespaces)

undo log can be independent of the system table space

The redo log can grow up to 512G

Innodb background thread is independent

Optimizer improvements

ICP

Data can be filtered directly at the engine layer to avoid secondary return to the table

Save BP space and improve query performance

BKA

Full name Batch Key Access:

When SQL wants to access the table data through the auxiliary index, it puts a large amount of random access into the cache and gives it to the MRR interface to merge it into sequential access.

MRR

Full name Multi Range Read:

After the BKA algorithm is applied, random access is merged into sequential access through the MRR interface, and then the table data is retrieved.

Change a lot of random to sequential access. Significant improvement in performance when retrieving large amounts of data through auxiliary indexes

The head does not need to seek back and forth, the page only needs to be read once, and the innodb linear pre-reading function is better used (pre-read 64 consecutive pages each time).

Persistent statistical information, not lost after mysqld restarts

The explain statement supports insert, update, delete, and replace statements, and supports JSON format

Improved subquery optimization.

Mysql5.7 features, compared to 5.5 5.6

safety

The plugin field of the user table mysql.user is not allowed to be empty. The default value is mysql_native_password instead of mysql_old_password, and the old password format is no longer supported;

Increase the password expiration mechanism, the password needs to be changed after the expiration, otherwise it may be disabled or enter the sandbox mode;

Increase the password expiration mechanism, the password needs to be changed after the expiration, otherwise it may be disabled or enter the sandbox mode;

Provides a simpler SSL security access configuration, and the default connection uses SSL encryption.

flexibility

Starting from version 5.7.8, MySQL database also provides support for JSON.

It can store structured data and unstructured data in a mixture, and has the advantages of relational and non-relational databases at the same time

Able to provide complete transaction support

The generated column is a new feature introduced in MySQL 5.7. The so-called generated column means that this column in the database is calculated by other columns.

Ease of use

Before MySQL 5.7, if the user enters a wrong SQL statement, press ctrl+c, although the SQL statement can be "ended", but the current session will also be exited. MySQL 5.7 improves this counterintuitive place. To no longer exit the conversation.

MySQL 5.7 can explain a running SQL, which is very useful for DBAs to analyze long-running statements.

sys schema is a system library introduced in MySQL 5.7.7, which contains a series of views, functions and stored procedures. This project focuses on the ease of use of MySQL.

For example: how to view redundant indexes in the database; how to obtain unused indexes; how to view SQL statements that use a full table scan.

Availability

It is no longer necessary to restart MySQL to set the replication filter rules online, just stop SQLthread, and start SQLthread after the modification is completed.

Modify the size of the buffer pool online.

Online DDL MySQL 5.7 supports renaming indexes and modifying the size of varchar. In previous versions, both operations require rebuilding indexes or tables.

Open GTID online. In the previous version, since online opening of GTID is not supported, if users want to upgrade a lower version database to a database version that supports GTID, they need to close the database first, and then start it in GTID mode, which causes the upgrade to be particularly troublesome. .

performance

Performance improvements for temporary tables.

Temporary tables are only visible in the current session

The life cycle of the temporary table is the current connection (MySQL is down or restarted, the current connection ends)

Improved read-only transaction performance.

MySQL 5.7 optimizes the overhead of read-only transactions and improves the overall performance of the database by avoiding allocating transaction IDs for read-only transactions, not assigning rollback segments for read-only transactions, and reducing lock contention.

Speed ​​up connection processing.

Prior to MySQL 5.7, variable initialization operations (THD, VIO) were all done in the connection receiving thread. Now these tasks are sent to the worker thread to reduce the workload of the connection receiving thread and improve the connection processing speed. This optimization will be very useful for applications that frequently establish short connections.

Improved replication performance (support for Multi-Threaded Slaves (MTS)

The default configuration of MySQL is parallel replication at the library level. In order to make full use of the parallel replication function of MySQL 5.7, we need to configure slave-parallel-type to LOGICAL_CLOCK.

Support Multi-source replication

Strictness change

STRICT_TRANS_TABLES mode is enabled by default.

More complex feature support is implemented for ONLY_FULL_GROUP_BY mode, and it is also enabled by default.

Other SQL mode enabled by default is NO_ENGINE_SUBSTITUTION.

Change of default parameters

The default binlog format is adjusted to ROW format

The operation after the default binlog error is adjusted to ABORT_SERVER

Under the previous option (binlog_error_action=IGNORE_ERROR), if an error occurs and the binlog cannot be written, mysql-server will record the error in the error log and force the binlog function to be turned off. This will make mysql-server continue to run in the mode of not recording the binlog, resulting in the slave database being unable to continue to obtain the binlog of the master database.

Binlog security when mysql crashes is enabled by default.

The slave_net_timeout is lowered by default.

Installation is different

mysql_install_db is no longer recommended. It is recommended to change to mysqld --initialize to complete the instance initialization. If there are data files in the target directory pointed to by datadir, there will be [ERROR] Aborting;

If you add --initial-insecure during initialization, a root@localhost account with an empty password will be created, otherwise a root@localhost account with a password will be created, and the password will be written directly in the log-error log file; new users need to log in Change the password immediately, otherwise the follow-up work cannot be continued.
————————————————
Copyright statement: This article is the original article of the CSDN blogger "jerry-89", and it follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and This statement.
Original link: https://blog.csdn.net/eagle89/article/details/80936899

Guess you like

Origin blog.csdn.net/qq_41536934/article/details/115036926