Outdated Version

You are viewing an older version of this section. View current production version.


Lock one or more tables.

LOCK TABLES tbl_name READ [, tbl_name READ] ...
Note that LOCK TABLES has been deprecated in MemSQL 6.


  • tbl_name is the name of a table in a MemSQL database.
  • Make all other MemSQL connections block when they try to write to tables locked for read.
  • The current connection can read these tables but not write to them.
  • LOCK TABLES will first unlock any table and database already locked by the same connection before locking.
  • This command must be run on the master aggregator or a child aggregator node (see Node Requirements for MemSQL Commands ).


memsql> LOCK TABLES mytbl READ;
Query OK, 0 rows affected (0.00 sec)