Sally
Sally

Reputation: 1789

MySQL MyISAM does an update statment lock the table and prevent reading?

I have MySQL database with a MyISAM structure. I know the update statement locks the table but does the lock prevent reading or just prevent others from inserting, deleting & updating the table?

Upvotes: 5

Views: 2181

Answers (2)

Nanne
Nanne

Reputation: 64419

from http://dev.mysql.com/doc/refman/5.1/en/internal-locking.html:

MySQL uses row-level locking for InnoDB tables, and table-level locking for MyISAM, MEMORY, and MERGE tables.

So you'll have a table-level write-lock, which means only you can access the table according to http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html

Only the session that holds the lock can access the table.

Upvotes: 3

Tony
Tony

Reputation: 10337

I'm not a MySQL expert but if you want to prevent reads have you read about the LOCK TABLES command?

Upvotes: 1

Related Questions