Lock and Unlock Syntax¶
MemSQL supports the following LOCK and UNLOCK syntax:
LOCK TABLES tbl_name READ [, tbl_name READ] ...
Make all other MemSQL connections block when they try to write to tables locked for read. Only the current connection can write into these tables. LOCK TABLES will first unlock any table and database already locked by the same connection before locking.
Unlock all table and database locks held by current connection. Locks held by current connection are automatically released when the current MemSQL connection is terminated.
FLUSH TABLES WITH READ LOCK
Lock all tables in the current database and make all other MemSQL connections block when they try to CREATE, ALTER or DROP tables. Statement will also wait until all write transactions in the current database are flushed to disk.