tags:

views:

72

answers:

2
A: 

In a REPEATABLE READ serialization level, the selected data from foo would be locked (but you could still append to foo, or alter lines that were not selected). If you only insert into bar, I do not believe any locks would happen on the existing rows in the table.

Also, do you have a reason not to use an insert-select ?

insert into bar (...) select ... from foo;
Victor Nicollet
A: 

No, an innodb operation like that will not lock any tables (Assuming default tx isolation level).

Normally there are no table-level locks at all, but there are some types of locking which can look like it.

With the default isolation level in innodb, readers never block writers and writers never block readers. This is by design.

And if you do an INSERT ... SELECT it'd be more efficient, but probably no different in terms of locking.

There is the InnoDB auto-inc mutex which you may want to read about (search the docs for more info), but that is not a table-lock.

MarkR