# What is the readlock for when copying data?

**URL:** <https://forums.percona.com/t/what-is-the-readlock-for-when-copying-data/925>\
**Category:** Other MySQL® Questions\
**Created:** [September 12, 2008, 8:07am UTC](https://forums.percona.com/t/what-is-the-readlock-for-when-copying-data/925 "2008-09-12T08:07:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![webmonkey](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/webmonkey/32/789_2.png) [@webmonkey](https://forums.percona.com/u/webmonkey)\
**Post date:** [September 12, 2008, 8:07am UTC](https://forums.percona.com/t/what-is-the-readlock-for-when-copying-data/925/1 "2008-09-12T08:07:56Z")

</div>

The tutorials / docs for setting up replication, suggest using a read lock before copying data eg:

FLUSH TABLES WITH READ LOCK;  
SET GLOBAL read\_only = ON;

What is the lock for?

My testing suggests that using a Read Lock inserts will wait, which could cause our webservers to fall over as the requests start to stack up. While jut setting read\_only with no lock will cause inserts to fail quickly; which is not ideal, but shouldn’t crash the webservers )

So why does everywhere say to use the read lock? What benefit is it?

thanks

---

<div class="post-metadata">

**Author:** ![xaprb](https://avatars.discourse-cdn.com/v4/letter/x/49beb7/32.png) [@xaprb](https://forums.percona.com/u/xaprb)\
**Post date:** [December 25, 2009, 10:49am UTC](https://forums.percona.com/t/what-is-the-readlock-for-when-copying-data/925/2 "2009-12-25T10:49:26Z")

</div>

Because to set up a replication slave you need a consistent copy of your data at a single point in time.
