# Schema Changes

## Overview

In MariaDB Enterprise Server, InnoDB supports many different schema change operations. Many of the operations can be performed online with concurrent DML using little or no locking.

## DDL Statements

InnoDB schema changes are performed using the following DDL statements:

* [ALTER TABLE](/docs/server/reference/sql-statements/data-definition/alter/alter-table.md)
* [CREATE INDEX](/docs/server/reference/sql-statements/data-definition/create/create-index.md)
* [CREATE SPATIAL INDEX](/docs/server/reference/sql-statements/data-definition/create/create-index.md)
* [CREATE UNIQUE INDEX](/docs/server/reference/sql-statements/data-definition/create/create-index.md)
* [DROP INDEX](/docs/server/reference/sql-statements/data-definition/drop/drop-index.md)
* [RENAME TABLE](/docs/server/reference/sql-statements/data-definition/rename-table.md)

## About InnoDB Schema Changes and Online DDL

InnoDB schema changes and online DDL are performed with a wide range of statements:

Each operation supports a subset of the following algorithms: `INSTANT, NOCOPY, INPLACE, or COPY`.

By default, InnoDB will use the most efficient algorithm supported by an operation. This behavior can be changed by using the `ALGORITHM` clause with the [ALTER TABLE](/docs/server/reference/sql-statements/data-definition/alter/alter-table.md) statement or by changing the value of the alter\_algorithm system variable.

Each operation supports a subset of the following locking strategies: `NONE, SHARED, or EXCLUSIVE`.

By default, InnoDB will use the most permissive locking strategy supported by an operation. This behavior can be changed by using the LOCK clause with the [ALTER TABLE](/docs/server/reference/sql-statements/data-definition/alter/alter-table.md) statement.

| Feature                                              | Detail | Resources                                                                                                                                                                                               |
| ---------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Operations support instant algorithm                 | Yes    | [InnoDB Schema Changes with the INSTANT Algorithm](/docs/server/server-usage/storage-engines/innodb/mariadb-enterprise-server-innodb-operations/schema-changes/schema-changes-innodb-schema-changes.md) |
| Operations support no-copy algorithm                 | Yes    | [InnoDB Schema Changes with the NOCOPY Algorithm](/docs/server/server-usage/storage-engines/innodb/mariadb-enterprise-server-innodb-operations/schema-changes/schema-changes-innodb-schema-changes.md)  |
| Operations support in-place algorithm                | Yes    | InnoDB Schema Changes with the INPLACE Algorithm                                                                                                                                                        |
| Adding a column                                      | Yes    |                                                                                                                                                                                                         |
| Dropping a column                                    | Yes    |                                                                                                                                                                                                         |
| Reordering columns                                   | Yes    |                                                                                                                                                                                                         |
| Changing a column to NULL                            | Yes    |                                                                                                                                                                                                         |
| Changing a column to NOT NULL                        | Yes    |                                                                                                                                                                                                         |
| Adding a new ENUM option                             | Yes    |                                                                                                                                                                                                         |
| Adding a new SET option                              | Yes    |                                                                                                                                                                                                         |
| Adding system versioning                             | Yes    |                                                                                                                                                                                                         |
| Removing system versioning                           | Yes    |                                                                                                                                                                                                         |
| Setting a column's DEFAULT                           | Yes    |                                                                                                                                                                                                         |
| Removing a column's DEFAULT                          | Yes    |                                                                                                                                                                                                         |
| Adding a primary key                                 | Yes    |                                                                                                                                                                                                         |
| Dropping a primary key                               | Yes    |                                                                                                                                                                                                         |
| Adding an index                                      | Yes    |                                                                                                                                                                                                         |
| Dropping an index                                    | Yes    |                                                                                                                                                                                                         |
| Adding a foreign key                                 | Yes    |                                                                                                                                                                                                         |
| Dropping a foreign key                               | Yes    |                                                                                                                                                                                                         |
| Setting the next AUTO\_INCREMENT value               | Yes    |                                                                                                                                                                                                         |
| Setting the row format                               | Yes    |                                                                                                                                                                                                         |
| Setting the block size for the Compressed row format | Yes    |                                                                                                                                                                                                         |
| Enabling page compression                            | Yes    |                                                                                                                                                                                                         |
| Setting the page compression level                   | Yes    |                                                                                                                                                                                                         |
| Disabling page compression                           | Yes    |                                                                                                                                                                                                         |
| Enabling data-at-rest encryption                     | Yes    |                                                                                                                                                                                                         |
| Setting the encryption key ID                        | Yes    |                                                                                                                                                                                                         |
| Disabling data-at-rest encryption                    | Yes    |                                                                                                                                                                                                         |
| Adding a constraint                                  | Yes    |                                                                                                                                                                                                         |
| Dropping a constraint                                | Yes    |                                                                                                                                                                                                         |
| Rebuilding the table                                 | Yes    |                                                                                                                                                                                                         |
| Renaming the table                                   | Yes    |                                                                                                                                                                                                         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/server-usage/storage-engines/innodb/mariadb-enterprise-server-innodb-operations/schema-changes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
