4084
MySQLERRORCommonHIGH confidence

InnoDB online index rebuild failed

Production Risk

High — Failed index rebuild leaves the table without the intended index and may cause query plan regressions.

Why it happens
  1. 1Insufficient temporary disk space for the sort buffer during index rebuild.
  2. 2A lock timeout or deadlock interrupted the online DDL operation.
  3. 3The table contains corrupted rows that prevent index creation.

Fix 1

Increase innodb_sort_buffer_size

Increase innodb_sort_buffer_size
SET GLOBAL innodb_sort_buffer_size = 67108864;

Why this works

Provides more memory for sorting rows during the index build phase.

Fix 2

Retry with ALGORITHM=COPY if online fails

Retry with ALGORITHM=COPY if online fails
ALTER TABLE t ADD INDEX idx (col) ALGORITHM=COPY;

Why this works

Falls back to a table copy which avoids online rebuild constraints.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 4084 ER_INNODB_INDEX_ONLINE_REBUILD_FAILED

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors