Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a database which is grown to 3GB and it has 3 MyISAM tables. And I have 4GB RAM. What will be the best (quick) way to backup this database without any performance lack.

Or mysqldump will work without any problem?

Edit I am not looking for a very big file containing lot of SQL statements. Now, do I have more options? Like raw data export or mysqlhotcopy as I am looking for a quicker way because backing up MyISAM would acquire table locking?

And what are the limits of mysqldump and when it should be avoided?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

mysqldump should be just fine. Since you have only 3GB of data, I expect the mysqldump to be decently fast (1-2 min as a single output). However, since your database is comprised of 3 MyISAM tables expect all three to be locked during the backup. Please keep mind that since tables are locked one at a time, you will not have point-in-time consistency across all tables in the database.

I have some scripts I wrote and still use to perform

  • parallel backups of separate databases
  • parallel backups of separate tables

If you are concerned with consistent data, you may need to implement something from Option 4 of the link I provided which executes "FLUSH TABLES WITH READ LOCK; SELECT SLEEP(86400);" in a separate session to lock all writes to all tables, perform the mysqldump(s), and then kill that session holding the tables locks.

If you are afraid to try executing this, you should look into using MySQL Replication. A slave server with the same data can be used to perform mysqldumps without imposing anything disk I/O or overall server load on the master database. You basically do these things on the DB Slave:

  • STOP SLAVE;
  • mysqldump
  • START SLAVE;

Give it a Try !!!

share|improve this answer
    
I was afraid of too much down time but if 3GB even takes 5 minutes, its bearable at the moment. So, I think I should go with the simplest approach. {about your Edit} I cannot go with this option because atm I have only single server. –  Gary Lindahl Oct 1 '11 at 23:04
add comment

Mysqldump would work like a charm and you'll not even notice any performance degrade because 3GB size can be handled easily and if you choose the first option of @Rolando script link then size would be greatly reduced very like that it would be a 500-600MB file.

There will always be 'lot' of sql statements in standard backup methods because that way when restoring you'll be telling MySQL to insert those data so it will be through SQL statements.

Now, other ways are to copy your data table or using mysqlhotcopy and it works good for MyISAM tables. But I would suggest easiest method that is using mysqldump because you don't have to worry about table level locking as it would be not noticed. This link maybe helpful to you Creating a Data Snapshot Using Raw Data Files and How to Restore MySQL Databases Without a mysqldump Backup.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.