Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 111247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:21:16+00:00 2026-05-11T02:21:16+00:00

When doing an ALTER TABLE statement in MySQL, the whole table is read-locked (allowing

  • 0

When doing an ALTER TABLE statement in MySQL, the whole table is read-locked (allowing concurrent reads, but prohibiting concurrent writes) for the duration of the statement. If it’s a big table, INSERT or UPDATE statements could be blocked for a looooong time. Is there a way to do a ‘hot alter’, like adding a column in such a way that the table is still updatable throughout the process?

Mostly I’m interested in a solution for MySQL but I’d be interested in other RDBMS if MySQL can’t do it.

To clarify, my purpose is simply to avoid downtime when a new feature that requires an extra table column is pushed to production. Any database schema will change over time, that’s just a fact of life. I don’t see why we should accept that these changes must inevitably result in downtime; that’s just weak.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:21:16+00:00Added an answer on May 11, 2026 at 2:21 am

    The only other option is to do manually what many RDBMS systems do anyway…
    – Create a new table

    You can then copy the contents of the old table over a chunk at a time. Whilst always being cautious of any INSERT/UPDATE/DELETE on the source table. (Could be managed by a trigger. Although this would cause a slow down, it’s not a lock…)

    Once finished, change the name of the source table, then change the name of the new table. Preferably in a transaction.

    Once finished, recompile any stored procedures, etc that use that table. The execution plans will likely no longer be valid.

    EDIT:

    Some comments have been made about this limitation being a bit poor. So I thought I’d put a new perspective on it to show why it’s how it is…

    • Adding a new field is like changing one field on every row.
    • Field Locks would be much harder than Row locks, never mind table locks.
    • You’re actually changing the physical structure on the disk, every record moves.
    • This really is like an UPDATE on the Whole table, but with more impact…
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with a whole bunch of FKs. Table Vehicles ----------- ColorID
I have a question about MySQL InnoDB. For example: I have the following table
I want to know how to define or declare Internal table in MySQL I
After doing some work with Ruby, Rails, and RSpec last summer and I learned
Context PHP 5.3.x Overview After doing a code-review with an associate who uses both
Alright, after doing a ton of research and trying almost every managed CPP Redist
I want to convert a string into a double and after doing some math
I'm writing a wizard for an Eclipse RCP application. After doing some processing on
I'm creating a fast application with ruby on rails, and after doing a lot
I'm just getting back into C++ after a couple of years of doing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.