How to create an snapshot for MySQL table

Viewed 5839

I have a table in MySQL database which is updated every five seconds. I want to take a snapshots of the table for testing purposes. How can i achieve this without affecting on table updating process?

2 Answers

A super-simple solution would involve mysqldump with --single-transaction option, which effectively starts a transaction and performs the dump. As this is happening within a transaction, you will get a consistent state of the database upon every dump (you can also instruct mysqldump to export only specific tables etc) and will have almost no impact on the writes.

Related