Clicking Add Index in a desktop MySQL client looks harmless. On a busy InnoDB table it is still ALTER TABLE, and the wrong algorithm copies the table, takes an exclusive lock at the end, and stalls writes until the copy finishes.
A click is still DDL
MySQL Workbench, DBeaver, HeidiSQL, TablePlus, and TabulaSQL all wrap the same server statement. The GUI dialog picks columns and uniqueness. The server decides whether that statement runs in place or copies the table.
CREATE INDEX idx_orders_created_at ON orders (created_at) is mapped to ALTER TABLE. If the client omits ALGORITHM and LOCK, MySQL uses the least locking it thinks it can. That default is usually fine on MySQL 8.4 for a plain secondary BTREE index. It is not fine for FULLTEXT, SPATIAL, or a primary-key rebuild.
Treat the GUI as a composer. Read the SQL it will send. On production, prefer an editor tab where you type the clauses yourself.
What InnoDB lets you do concurrently
MySQL 8.4 documents these index operations for InnoDB:
| Operation | In place | Concurrent DML | Notes |
|---|---|---|---|
| Add secondary BTREE index | Yes | Yes | Use ALGORITHM=INPLACE, LOCK=NONE |
| Drop secondary index | Yes | Yes | Metadata-only; still needs a brief exclusive metadata lock at commit |
| Rename index | Yes | Yes | Same LOCK=NONE pattern |
| Add UNIQUE secondary index | Yes | Yes | Fails if duplicates exist |
| Add FULLTEXT or SPATIAL | Yes* | No | Do not run on a write-hot table during peak |
| Add or drop PRIMARY KEY | Rebuilds clustered index | Mixed | Copies table data; schedule it |
LOCK=NONE is the useful part. If the server cannot keep concurrent queries and DML, the statement errors instead of silently taking a stronger lock. That fail-closed behavior is why you type the clause instead of trusting a dialog default.
MariaDB 10.4 and newer follow the same idea for ordinary secondary indexes: ALGORITHM=INPLACE, LOCK=NONE on ALTER TABLE ... ADD INDEX. Confirm on a staging copy of the same engine and version before you touch production.
Inspect the table in the index manager first
Open your MySQL or MariaDB connection. Color-label production if you keep staging and live servers in the same sidebar. Expand the schema, then right-click the table (for example orders) and open the index manager.
TabulaSQL lists existing indexes with uniqueness and column order, matching PRIMARY, uniq_sku, and idx_category on a products table. Adding an index there is picking columns and optionally marking Unique. Dropping is a red, confirmed action. Index managers are deepest on MySQL and MariaDB. PostgreSQL and SQLite connections browse and query, but this workflow is for InnoDB.
Before you add anything, check three facts in the manager and with SQL:
- The columns you want are already leading another index (
idx_status_created (status, created_at)already coversstatus). - You are not about to add a duplicate of PRIMARY or a UNIQUE key that the app already uses.
- Cardinality looks useful. A boolean
is_activecolumn alone is a weak index on a large table.
Run SHOW INDEX FROM orders in a query tab if you want the raw Seq_in_index, Non_unique, and Cardinality values. Pair that with EXPLAIN on the slow query so you index the predicates the optimizer actually uses. The companion guide How to read MySQL EXPLAIN in a GUI covers type and Extra.
Add a secondary index with LOCK=NONE
Use the index manager on local Docker or staging. On a table with live traffic, paste the statement in the SQL editor so you control the clauses.
- Confirm you are on staging first, or on a color-labeled production connection with a dedicated migration user (
ALTERprivilege, notrootshared with the app). - Check
SHOW PROCESSLISTfor long-running transactions on that table. A forgottenBEGINin a GUI tab holds a metadata lock and will stall your DDL at commit. - Paste this shape, then run the selection with Ctrl/Cmd+Shift+Enter:
ALTER TABLE orders
ADD INDEX idx_orders_created_at (created_at),
ALGORITHM=INPLACE,
LOCK=NONE;
- Watch
SHOW PROCESSLISTforWaiting for table metadata lockand for the alter itself. Concurrent DML should continue. I/O will still rise while InnoDB builds the index. - If the statement errors because
LOCK=NONEis not allowed, stop. Do not retry without the clause. That is how you accidentally copy the table. - After success,
ANALYZE TABLE ordersso persistent stats catch up, then re-run EXPLAIN on the original query.
If concurrent writes fill innodb_online_alter_log_max_size (default 128MB), the in-place build fails rather than locking the table. Raise the variable in a maintenance window, or build the index during a quieter period.
A free desktop client such as TabulaSQL gives you the index manager for inspection and the editor for the LOCK=NONE statement in the same window. Safe Lock previews row INSERT, UPDATE, and DELETE SQL. Schema changes still belong in a query tab you can read twice.
Drop an index on a live table
Dropping a secondary InnoDB index is in-place and metadata-heavy. Writes keep going, but the statement waits for every transaction that touched the table to finish before it can take the exclusive metadata lock at the end.
In the index manager, select the unused index (never PRIMARY unless you have a replacement plan) and confirm the drop. Prefer the editor on production:
ALTER TABLE orders
DROP INDEX idx_orders_created_at,
ALGORITHM=INPLACE,
LOCK=NONE;
Do not drop an index that a replica or a reporting query still needs. Check performance_schema.table_io_waits_summary_by_index_usage or slow query logs first. Dropping PRIMARY requires copying the table if you do not add a new primary key in the same statement. Leave that for a planned rewrite, not a lunch-break click.
Fail closed when the server cannot stay online
FULLTEXT and SPATIAL indexes do not permit concurrent DML. Unique indexes fail if duplicates exist. Adding a primary key copies clustered data even with ALGORITHM=INPLACE. Tools such as pt-online-schema-change or gh-ost exist for those rebuilds. They are extra machinery for a plain secondary BTREE index on MySQL 8.4, where LOCK=NONE already refuses a blocking copy.
If the GUI you use cannot show the generated ALTER TABLE before it runs, type the statement yourself. The lock risk lives on the server, not in the dialog label. After the index exists, re-run EXPLAIN and keep it only if type moved off ALL.