HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

What happens to an insert when a mysql(innoDB) table is being altered(locked)?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
insertwhatinnodblockedalteredbeingmysqlwhenhappenstable

Problem

I am trying to alter a database column by using:

ALTER TABLE [table name] MODIFY id bigint;


I searched and found out that the table gets locked during the ALTER process.

How do the inserts get affected during the ALTER process? Do they wait until the lock is released? Is there a timeout?

If the inserts wait for the lock to be released, is there a limit of how many inserts that could wait?

Solution

What version of MySQL are you using?

Have you considered ALGORITHM=inplace and LOCK=none in your ALTER TABLE statement?

See also Using the LOCK clause to control concurrency

Context

StackExchange Database Administrators Q#176445, answer score: 2

Revisions (0)

No revisions yet.