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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 356k
  • Answers 356k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, create a stored procedure to do this. May 14, 2026 at 8:56 am
  • Editorial Team
    Editorial Team added an answer See this post May 14, 2026 at 8:56 am
  • Editorial Team
    Editorial Team added an answer Right click the .sql file within Visual Studio, then click… May 14, 2026 at 8:56 am

Related Questions

I'm trying to do a huge bulk insert into an SqlCe database (version 3.5,
I am using Jruby and rails 2.2.2. My problem is I have a migration
I'm using a SELECT statement in T-SQL on a table similar to this: SELECT
So I have a form that I want the user to use to update

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.