Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of the Internal implementation principle of mysqldump

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you the principle of mysqldump internal implementation of the example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!

We can understand the principle behind mysqldump by opening general log and looking at the commands executed during the full library backup of mysqldump.

Open general log

Mysql > set global general_log=on

The storage path of general log can be viewed by using the following command

Mysql > show variables like'% general_log_file%'

Summary

1.-- master-data is generated as follows, so that DDL and DML cannot be executed during mysqldump, and if there is a lock in the table before executing mysqldump, mysqldump will wait and export the data at the moment when mysqldump occurs.

FLUSH / *! 40101 LOCAL * / TABLES and FLUSH TABLES WITH READ LOCK and SHOW MASTER STATUS

2.-- lock-all-tables is generated as follows, so that DDL and DML cannot be executed during mysqldump, and if there is a lock in the table before executing mysqldump, mysqldump will wait and export the data at the moment when mysqldump occurs.

FLUSH TABLES and FLUSH TABLES WITH READ LOCK

3. When-- master-data and-- lock-all-tables are used at the same time, the effect is the same as-- master-data

4.-- single-transaction is generated as follows. DML and DDL are not affected during mysqldump, but mysqldump itself may report an error exit due to the influence of DDL. The table before mysqldump has a lock, and mysqldump will not wait. The export result is the data at the moment when mysqldump occurs.

UNLOCK TABLES,SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ,SAVEPOINT,ROLLBACK TO SAVEPOINT,RELEASE SAVEPOINT

5.-- skip-lock-tables does not generate any LOCK,mysqldump period that does not affect DML and DDL, but mysqldump itself may report an error exit due to the influence of DDL. The table before mysqldump has a lock, and mysqldump will not wait. The export result is not the data at this moment of mysqldump, but the data of that table at the beginning of the import (for example, if the lead A table is 8:00, the export process takes an hour, and the export result is also 8:00 data. If the import B table is 9:00, the export process takes an hour, and the export result of B is also 9:00 data), which is similar to the expdp of oracle.

6. The default export is generated as follows, which will result in that during mysqldump, the library executing the export cannot execute DDL and DML, the table is locked before the library executing the export can execute DDL and DML,mysqldump, and the mysqldump will not wait. The export result is not the data at the moment when mysqldump occurs, but the data from that library at the beginning of the import A library (for example, if the import A library is 8:00, the export process will take an hour. The export result of An is also 8:00 data, if the import B library is 9:00, the export process takes an hour, and the export result of B is also 9:00 data).

LOCK TABLES `table1` READ / *! 32311 LOCAL * /, `table2` READ / *! 32311 LOCAL * /

UNLOCK TABLES

7. Generate database building statement, generate table building statement, backup core statement (this statement queries all the data of table table1, and the corresponding insert statement will be generated in the backup file. The function of SQL_NO_CACHE is that the results of the query are not cached in the query cache), as follows

SHOW CREATE DATABASE IF NOT EXISTS `test1`

Show create table `table1`

SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table1`

-- the master-data log is as follows

There are FLUSH / *! 40101 LOCAL * / TABLES and FLUSH TABLES WITH READ LOCK and SHOW MASTER STATUS

There is no UNLOCK.

Mysqldump-- master-data=2-- databases test1 > / home/test1_2.sql

2019-01-06T06:29:59.361208Z 4 Connect root@localhost on using Socket

2019-01-06T06:29:59.361337Z 4 Query / *! 40100 SET @ @ SQL_MODE='' * /

2019-01-06T06:29:59.361434Z 4 Query / *! 40103 SET TIME_ZONE='+00:00' * /

2019-01-06T06:29:59.361558Z 4 Query FLUSH / *! 40101 LOCAL * / TABLES

2019-01-06T06:29:59.369450Z 4 Query FLUSH TABLES WITH READ LOCK

2019-01-06T06:29:59.369580Z 4 Query SHOW VARIABLES LIKE 'gtid\ _ mode'

2019-01-06T06:29:59.372284Z 4 Query SHOW MASTER STATUS

2019-01-06T06:29:59.372533Z 4 Query SELECT.

...

2019-01-06T06:29:59.375795Z 4 Query SHOW VARIABLES LIKE 'ndbinfo\ _ version'

2019-01-06T06:29:59.378605Z 4 Init DB test1

2019-01-06T06:29:59.378670Z 4 Query SHOW CREATE DATABASE IF NOT EXISTS `test1`

2019-01-06T06:29:59.378767Z 4 Query show tables

2019-01-06T06:29:59.379070Z 4 Query show table status like 'table1'

2019-01-06T06:29:59.379457Z 4 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-06T06:29:59.379555Z 4 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:29:59.379649Z 4 Query show create table `table1`

2019-01-06T06:29:59.379778Z 4 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:29:59.379940Z 4 Query show fields from `table1`

2019-01-06T06:29:59.380463Z 4 Query show fields from `table1`

2019-01-06T06:29:59.380933Z 4 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table1`

2019-01-06T06:29:59.381225Z 4 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:29:59.381323Z 4 Query use `test1`

2019-01-06T06:29:59.381416Z 4 Query select @ @ collation_database

2019-01-06T06:29:59.381546Z 4 Query SHOW TRIGGERS LIKE 'table1'

2019-01-06T06:29:59.382209Z 4 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:29:59.382309Z 4 Query show table status like 'table2'

2019-01-06T06:29:59.382597Z 4 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-06T06:29:59.382670Z 4 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:29:59.382746Z 4 Query show create table `table2`

2019-01-06T06:29:59.382848Z 4 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:29:59.382983Z 4 Query show fields from `table2`

2019-01-06T06:29:59.383385Z 4 Query show fields from `table2`

2019-01-06T06:29:59.383782Z 4 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table2`

2019-01-06T06:29:59.384125Z 4 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:29:59.384223Z 4 Query use `test1`

2019-01-06T06:29:59.384312Z 4 Query select @ @ collation_database

2019-01-06T06:29:59.384430Z 4 Query SHOW TRIGGERS LIKE 'table2'

2019-01-06T06:29:59.385032Z 4 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:29:59.420821Z 4 Quit

-- the single-transaction log is as follows

No FLUSH / *! 40101 LOCAL * / TABLES and FLUSH TABLES WITH READ LOCK

Only UNLOCK TABLES,SAVEPOINT,ROLLBACK TO SAVEPOINT,RELEASE SAVEPOINT.

Mysqldump-- single-transaction-- databases test1 > / home/test1_2.sql

2019-01-06T06:16:52.542170Z 8 Connect root@localhost on using Socket

2019-01-06T06:16:52.542314Z 8 Query / *! 40100 SET @ @ SQL_MODE='' * /

2019-01-06T06:16:52.542433Z 8 Query / *! 40103 SET TIME_ZONE='+00:00' * /

2019-01-06T06:16:52.542593Z 8 Query SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ

2019-01-06T06:16:52.542674Z 8 Query START TRANSACTION / *! 40100 WITH CONSISTENT SNAPSHOT * /

2019-01-06T06:16:52.542794Z 8 Query SHOW VARIABLES LIKE 'gtid\ _ mode'

2019-01-06T06:16:52.545877Z 8 Query UNLOCK TABLES

2019-01-06T06:16:52.546158Z 8 Query SELECT...

...

2019-01-06T06:16:52.550745Z 8 Query SHOW VARIABLES LIKE 'ndbinfo\ _ version'

2019-01-06T06:16:52.553711Z 8 Init DB test1

2019-01-06T06:16:52.553793Z 8 Query SHOW CREATE DATABASE IF NOT EXISTS `test1`

2019-01-06T06:16:52.553896Z 8 Query SAVEPOINT sp

2019-01-06T06:16:52.554040Z 8 Query show tables

2019-01-06T06:16:52.554281Z 8 Query show table status like 'table1'

2019-01-06T06:16:52.554665Z 8 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-06T06:16:52.554766Z 8 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:16:52.554862Z 8 Query show create table `table1`

2019-01-06T06:16:52.555144Z 8 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:16:52.555263Z 8 Query show fields from `table1`

2019-01-06T06:16:52.555766Z 8 Query show fields from `table1`

2019-01-06T06:16:52.556323Z 8 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table1`

2019-01-06T06:16:52.556585Z 8 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:16:52.556682Z 8 Query use `test1`

2019-01-06T06:16:52.556776Z 8 Query select @ @ collation_database

2019-01-06T06:16:52.556908Z 8 Query SHOW TRIGGERS LIKE 'table1'

2019-01-06T06:16:52.557623Z 8 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:16:52.557709Z 8 Query ROLLBACK TO SAVEPOINT sp

2019-01-06T06:16:52.557793Z 8 Query show table status like 'table2'

2019-01-06T06:16:52.558118Z 8 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-06T06:16:52.558191Z 8 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:16:52.558264Z 8 Query show create table `table2`

2019-01-06T06:16:52.558391Z 8 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:16:52.558481Z 8 Query show fields from `table2`

2019-01-06T06:16:52.558904Z 8 Query show fields from `table2`

2019-01-06T06:16:52.559413Z 8 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table2`

2019-01-06T06:16:52.559580Z 8 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:16:52.559653Z 8 Query use `test1`

2019-01-06T06:16:52.559726Z 8 Query select @ @ collation_database

2019-01-06T06:16:52.559858Z 8 Query SHOW TRIGGERS LIKE 'table2'

2019-01-06T06:16:52.560307Z 8 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:16:52.560378Z 8 Query ROLLBACK TO SAVEPOINT sp

2019-01-06T06:16:52.560465Z 8 Query RELEASE SAVEPOINT sp

2019-01-06T06:16:52.658772Z 8 Quit

-- the skip-lock-tables log is as follows

No FLUSH / *! 40101 LOCAL * / TABLES and FLUSH TABLES WITH READ LOCK

And there's no UNLOCK.

Mysqldump-- skip-lock-tables-- databases test2 > / home/test1_2.sql

2019-01-03T14:35:41.956739Z 7 Connect root@localhost on using Socket

2019-01-03T14:35:41.956875Z 7 Query / *! 40100 SET @ @ SQL_MODE='' * /

2019-01-03T14:35:41.956976Z 7 Query / *! 40103 SET TIME_ZONE='+00:00' * /

2019-01-03T14:35:41.957122Z 7 Query SHOW VARIABLES LIKE 'gtid\ _ mode'

2019-01-03T14:35:41.959794Z 7 Query SELECT.

...

2019-01-03T14:35:41.965124Z 7 Query SHOW VARIABLES LIKE 'ndbinfo\ _ version'

2019-01-03T14:35:41.967453Z 7 Init DB test2

2019-01-03T14:35:41.967557Z 7 Query SHOW CREATE DATABASE IF NOT EXISTS `test2`

2019-01-03T14:35:41.967659Z 7 Query show tables

2019-01-03T14:35:41.967871Z 7 Query show table status like 't1'

2019-01-03T14:35:41.968196Z 7 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-03T14:35:41.968279Z 7 Query SET SESSION character_set_results = 'binary'

2019-01-03T14:35:41.968359Z 7 Query show create table `t1`

2019-01-03T14:35:41.968468Z 7 Query SET SESSION character_set_results = 'utf8'

2019-01-03T14:35:41.968690Z 7 Query show fields from `t1`

2019-01-03T14:35:41.969127Z 7 Query show fields from `t1`

2019-01-03T14:35:41.969589Z 7 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `t1`

2019-01-03T14:35:41.969824Z 7 Query SET SESSION character_set_results = 'binary'

2019-01-03T14:35:41.969906Z 7 Query use `test2`

2019-01-03T14:35:41.969986Z 7 Query select @ @ collation_database

2019-01-03T14:35:41.970098Z 7 Query SHOW TRIGGERS LIKE 't1'

2019-01-03T14:35:41.970753Z 7 Query SET SESSION character_set_results = 'utf8'

2019-01-03T14:35:41.970855Z 7 Query show table status like 't2'

2019-01-03T14:35:41.971246Z 7 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-03T14:35:41.971325Z 7 Query SET SESSION character_set_results = 'binary'

2019-01-03T14:35:41.971404Z 7 Query show create table `t2`

2019-01-03T14:35:41.971671Z 7 Query SET SESSION character_set_results = 'utf8'

2019-01-03T14:35:41.971807Z 7 Query show fields from `t2`

2019-01-03T14:35:41.972269Z 7 Query show fields from `t2`

2019-01-03T14:35:41.972777Z 7 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `t2`

The default backup log is as follows

No FLUSH / *! 40101 LOCAL * / TABLES and FLUSH TABLES WITH READ LOCK

But there's LOCK TABLES, and it ends with UNLOCK TABLES.

Mysqldump-- databases test2 > / home/test1_2.sql

2019-01-03T14:38:19.276575Z 8 Connect root@localhost on using Socket

2019-01-03T14:38:19.276814Z 8 Query / *! 40100 SET @ @ SQL_MODE='' * /

2019-01-03T14:38:19.276918Z 8 Query / *! 40103 SET TIME_ZONE='+00:00' * /

2019-01-03T14:38:19.277065Z 8 Query SHOW VARIABLES LIKE 'gtid\ _ mode'

2019-01-03T14:38:19.279690Z 8 Query SELECT.

...

2019-01-03T14:38:19.285033Z 8 Query SHOW VARIABLES LIKE 'ndbinfo\ _ version'

2019-01-03T14:38:19.287392Z 8 Init DB test2

2019-01-03T14:38:19.287461Z 8 Query SHOW CREATE DATABASE IF NOT EXISTS `test2`

2019-01-03T14:38:19.287559Z 8 Query show tables

2019-01-03T14:38:19.287886Z 8 Query LOCK TABLES `t1` READ / *! 32311 LOCAL * /, `t2` READ / *! 32311 LOCAL * /, `t3` READ / *! 32311 LOCAL * /, `t4` READ / *! 32311 LOCAL * /, `t7` READ / *! 32311 LOCAL * /

2019-01-03T14:38:19.288043Z 8 Query show table status like 't1'

2019-01-03T14:38:19.288403Z 8 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-03T14:38:19.288488Z 8 Query SET SESSION character_set_results = 'binary'

2019-01-03T14:38:19.288569Z 8 Query show create table `t1`

2019-01-03T14:38:19.288714Z 8 Query SET SESSION character_set_results = 'utf8'

2019-01-03T14:38:19.288808Z 8 Query show fields from `t1`

2019-01-03T14:38:19.289236Z 8 Query show fields from `t1`

2019-01-03T14:38:19.289789Z 8 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `t1`

2019-01-03T14:38:19.290008Z 8 Query SET SESSION character_set_results = 'binary'

2019-01-03T14:38:19.290090Z 8 Query use `test2`

2019-01-03T14:38:19.290171Z 8 Query select @ @ collation_database

2019-01-03T14:38:19.290281Z 8 Query SHOW TRIGGERS LIKE 't1'

2019-01-03T14:38:19.290768Z 8 Query SET SESSION character_set_results = 'utf8'

2019-01-03T14:38:19.290869Z 8 Query show table status like 't2'

2019-01-03T14:38:19.291184Z 8 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-03T14:38:19.291260Z 8 Query SET SESSION character_set_results = 'binary'

2019-01-03T14:38:19.291338Z 8 Query show create table `t2`

2019-01-03T14:38:19.291437Z 8 Query SET SESSION character_set_results = 'utf8'

2019-01-03T14:38:19.291528Z 8 Query show fields from `t2`

2019-01-03T14:38:19.292061Z 8 Query show fields from `t2`

2019-01-03T14:38:19.292454Z 8 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `t2`

2019-01-03T14:38:19.292612Z 8 Query SET SESSION character_set_results = 'binary'

...

2019-01-03T14:38:19.302719Z 8 Query UNLOCK TABLES

2019-01-03T14:38:19.306712Z 8 Quit

-- lock-all-tables

Generate FLUSH TABLES and FLUSH TABLES WITH READ LOCK

There is no UNLOCK.

Mysqldump-- lock-all-tables-- databases test1 > / home/test1_2.sql

2019-01-06T06:47:17.614479Z 5 Connect root@localhost on using Socket

2019-01-06T06:47:17.614801Z 5 Query / *! 40100 SET @ @ SQL_MODE='' * /

2019-01-06T06:47:17.614922Z 5 Query / *! 40103 SET TIME_ZONE='+00:00' * /

2019-01-06T06:47:17.615074Z 5 Query FLUSH TABLES

2019-01-06T06:47:17.620471Z 5 Query FLUSH TABLES WITH READ LOCK

2019-01-06T06:47:17.620629Z 5 Query SHOW VARIABLES LIKE 'gtid\ _ mode'

2019-01-06T06:47:17.623672Z 5 Query SELECT.

...

2019-01-06T06:47:17.626996Z 5 Query SHOW VARIABLES LIKE 'ndbinfo\ _ version'

2019-01-06T06:47:17.629714Z 5 Init DB test1

2019-01-06T06:47:17.629798Z 5 Query SHOW CREATE DATABASE IF NOT EXISTS `test1`

2019-01-06T06:47:17.629916Z 5 Query show tables

2019-01-06T06:47:17.630154Z 5 Query show table status like 'table1'

2019-01-06T06:47:17.630615Z 5 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-06T06:47:17.630702Z 5 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:47:17.630780Z 5 Query show create table `table1`

2019-01-06T06:47:17.630889Z 5 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:47:17.630979Z 5 Query show fields from `table1`

2019-01-06T06:47:17.631397Z 5 Query show fields from `table1`

2019-01-06T06:47:17.632023Z 5 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table1`

2019-01-06T06:47:17.632286Z 5 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:47:17.632384Z 5 Query use `test1`

2019-01-06T06:47:17.632479Z 5 Query select @ @ collation_database

2019-01-06T06:47:17.632668Z 5 Query SHOW TRIGGERS LIKE 'table1'

2019-01-06T06:47:17.633103Z 5 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:47:17.633202Z 5 Query show table status like 'table2'

2019-01-06T06:47:17.633489Z 5 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-06T06:47:17.633713Z 5 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:47:17.633811Z 5 Query show create table `table2`

2019-01-06T06:47:17.633937Z 5 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:47:17.634045Z 5 Query show fields from `table2`

2019-01-06T06:47:17.634532Z 5 Query show fields from `table2`

2019-01-06T06:47:17.635011Z 5 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table2`

2019-01-06T06:47:17.635177Z 5 Query SET SESSION character_set_results = 'binary'

2019-01-06T06:47:17.635250Z 5 Query use `test1`

2019-01-06T06:47:17.635317Z 5 Query select @ @ collation_database

2019-01-06T06:47:17.635400Z 5 Query SHOW TRIGGERS LIKE 'table2'

2019-01-06T06:47:17.635962Z 5 Query SET SESSION character_set_results = 'utf8'

2019-01-06T06:47:17.639473Z 5 Quit

-- lock-all-tables-- master-data at the same time

Mysqldump-lock-all-tables-master-data=2-databases test1 > / home/test1_2.sql

2019-01-06T07:11:08.806918Z 10 Connect root@localhost on using Socket

2019-01-06T07:11:08.807047Z 10 Query / *! 40100 SET @ @ SQL_MODE='' * /

2019-01-06T07:11:08.807174Z 10 Query / *! 40103 SET TIME_ZONE='+00:00' * /

2019-01-06T07:11:08.807392Z 10 Query FLUSH / *! 40101 LOCAL * / TABLES

2019-01-06T07:11:08.807499Z 10 Query FLUSH TABLES WITH READ LOCK

2019-01-06T07:11:08.807598Z 10 Query SHOW VARIABLES LIKE 'gtid\ _ mode'

2019-01-06T07:11:08.810307Z 10 Query SHOW MASTER STATUS

2019-01-06T07:11:08.810538Z 10 Query SELECT.

...

2019-01-06T07:11:08.813490Z 10 Query SHOW VARIABLES LIKE 'ndbinfo\ _ version'

2019-01-06T07:11:08.815880Z 10 Init DB test1

2019-01-06T07:11:08.815948Z 10 Query SHOW CREATE DATABASE IF NOT EXISTS `test1`

2019-01-06T07:11:08.816048Z 10 Query show tables

2019-01-06T07:11:08.816379Z 10 Query show table status like 'table1'

2019-01-06T07:11:08.816703Z 10 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-06T07:11:08.816787Z 10 Query SET SESSION character_set_results = 'binary'

2019-01-06T07:11:08.816868Z 10 Query show create table `table1`

2019-01-06T07:11:08.816977Z 10 Query SET SESSION character_set_results = 'utf8'

2019-01-06T07:11:08.817070Z 10 Query show fields from `table1`

2019-01-06T07:11:08.817533Z 10 Query show fields from `table1`

2019-01-06T07:11:08.817952Z 10 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table1`

2019-01-06T07:11:08.818288Z 10 Query SET SESSION character_set_results = 'binary'

2019-01-06T07:11:08.818376Z 10 Query use `test1`

2019-01-06T07:11:08.818455Z 10 Query select @ @ collation_database

2019-01-06T07:11:08.818567Z 10 Query SHOW TRIGGERS LIKE 'table1'

2019-01-06T07:11:08.818996Z 10 Query SET SESSION character_set_results = 'utf8'

2019-01-06T07:11:08.819080Z 10 Query show table status like 'table2'

2019-01-06T07:11:08.819376Z 10 Query SET SQL_QUOTE_SHOW_CREATE=1

2019-01-06T07:11:08.819439Z 10 Query SET SESSION character_set_results = 'binary'

2019-01-06T07:11:08.819503Z 10 Query show create table `table2`

2019-01-06T07:11:08.819589Z 10 Query SET SESSION character_set_results = 'utf8'

2019-01-06T07:11:08.819664Z 10 Query show fields from `table2`

2019-01-06T07:11:08.819993Z 10 Query show fields from `table2`

2019-01-06T07:11:08.820434Z 10 Query SELECT / *! 40001 SQL_NO_CACHE * / * FROM `table2`

2019-01-06T07:11:08.820578Z 10 Query SET SESSION character_set_results = 'binary'

2019-01-06T07:11:08.820644Z 10 Query use `test1`

2019-01-06T07:11:08.820707Z 10 Query select @ @ collation_database

2019-01-06T07:11:08.820789Z 10 Query SHOW TRIGGERS LIKE 'table2'

2019-01-06T07:11:08.821171Z 10 Query SET SESSION character_set_results = 'utf8'

2019-01-06T07:11:08.846442Z 10 Quit

SELECT...

...

In the case of

2019-01-01T06:16:52.546158Z 8 Query SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'UNDO LOG' AND FILE_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE =' DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('test1') GROUP BY LOGFILE_GROUP_NAME FILE_NAME, ENGINE ORDER BY LOGFILE_GROUP_NAME

2019-01-01T06:16:52.549144Z 8 Query SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN (' test1')) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME

The above is all the contents of the article "example Analysis of the Internal implementation principle of mysqldump". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report