I can't seem to find the internals for –single-transaction mysqldump option for InnoDB tables, but is it possible to use –single-transaction for single tables in a parallel dump so that the –single-transaction only affects the current table I'm dumping and it is safe to run in parallel for quicker dumps? I tested this on a development server and works well but without knowing the internal locking methods I am worried to use it in production
Mysql – Is it safe to run parallel innodb single-transaction dumps of individual tables
backupinnodbMySQLmysqldump
Related Question
- Mysql – How to upgrade MySQL (5.5) production DB to 5.6 with minimal downtime
- Thesqldump –single-transaction, yet update queries are waiting for the backup
- Mysql – Are there any risks on using ‘single-transaction’ and ‘extended-insert’ on thesqldump
- Thesqldump –no-data and –single-transaction
- Mysql – Safe online dumping of an InnoDB database in the presence of DDL changes
- Mysql – Consistent InnoDB dumps with thesqldump
Best Answer
While parallel --single-transaction dumps on tables are possible, there are many things you must take under consideration:
InnoDB Buffer Pool
When you mysqldump a single table, the connection launches a
START TRANSACTION
followed bySELECT /*!40001 SQL_NO_CACHE */ ....
. Naturally, this will push all data pages for the dumped table through the InnoDB Buffer Pool. Launching parallel dumps would just make the Buffer Pool become a funnel because of passing multiple tables through it. The combined time of each table dump may not necessarily be be less that dumping all the table sequentially if the combined size of the table is greater than innodb_buffer_pool_size.Binary Log Position
When doing parallel dumps with --master-data on a DB Server with binary logging enabled, you will quickly realize that the dump of each table is not perfectly consistent. Why ? When launching a mysqldump of everything, lines 23-25 will contain a
CHANGE MASTER TO
command before the dump data/schema. Each dump will have a differentmaster_log_pos
, especially coming from a live system.Locking
You had made for following statement
Performing a single transaction dump does not trigger any kind of locking. According to the MySQL Documentation on --single-transaction:
SUGGESTION
I have recommended doing parallel dumps in the past (See my old post How can I optimize a mysqldump of a large database? under the heading
Option 3 : mysqldump separate tables into separate data files
)If you want to launch parallel dumps of tables in Production, it is best to setup MySQL Replication. Then on the Backup Slave, you can do the following:
STOP SLAVE IO_THREAD;
SHOW SLAVE STATUS\G
shows thatExec_Master_Log_Pos
stops changing)START SLAVE;
GIVE IT A TRY !!!