Thesqldump: dump several tables from db. what will be locked

backupMySQLmysqldump

I have active database with dozens of tables. Among them several are unused (no queries/insertions are performing over them for a while).
I want to dump that inactive tables. I would suggest that it will be harmless to use mysqldump -u.. -h.. -p... mydb tbl1 tbl2 > dump.sql and nothing except that tables will be locked?

Best Answer

Given the current way you are doing it

mysqldump -u.. -h.. -p... mydb tbl1 tbl2

each table is locked during the SELECT phase in a specific way

Note the effects during the dump

  • Each table that is MyISAM should allow SELECTs but block INSERTs, UPDATEs and DELETEs
  • While dumping tbl1, tbl2 is fully accessible
  • While dumping tbl2, tbl1 is fully accessible

If those tables (tbl1 and tbl2) are inactive, then such a dump would be harmless to busy tables.