Getting Started with MySQL DDL

Getting Started with MySQL DDL

March 20, 2020

This document is described based on MySQL 5.6.

Online DDL

On MYSQL 5.6, DDL can be ran online, without maintenance. There are two important types of online DDL.

  1. Algorithm
    • COPY: Concurrent DML is not supported. New table is copied from original table and.
    • INPLACE: Concurrent DML may be supported, but sometimes, exclusive lock is taken. Avoid copying tables to update schema.
    • DEFAULT: Use INPLACE if it is supported for running DDL. Otherwise, COPY.
  2. LOCK
    • NONE: Permit concurrent reads and writes, or error occurs.
    • SHARED: Permit concurrent reads but block writes, or error occurs.
    • EXCLUSIVE: Block reads and writes.
    • DEFAULT: Choose one way from NONE, SHARED, or EXCLUSIVE by this priority.

It’s recommended to read the official document at first to understand the more details for what happens in each operation.

Last updated on