Medium severityschema
Power BI Refresh Error:
1071
What does this error mean?
An index key exceeds the maximum allowed key length for the storage engine and row format.
Common causes
- 1Creating an index on a VARCHAR column with utf8mb4 encoding — utf8mb4 uses 4 bytes per character, so VARCHAR(255) = 1020 bytes, exceeding the 767-byte InnoDB limit for older row formats
- 2Composite index with multiple large VARCHAR columns exceeds the 3072-byte limit (innodb_large_prefix enabled)
- 3Using the COMPACT or REDUNDANT InnoDB row format without innodb_large_prefix
How to fix it
- 1Step 1: Enable large prefix (MySQL 5.6-5.7): `SET GLOBAL innodb_large_prefix=ON; SET GLOBAL innodb_file_format=Barracuda;` and use ROW_FORMAT=DYNAMIC.
- 2Step 2: In MySQL 8.0+, use DYNAMIC row format by default: `CREATE TABLE t (...) ROW_FORMAT=DYNAMIC;`
- 3Step 3: Reduce the indexed column length: create a prefix index: `CREATE INDEX idx ON your_table (col(191));` — 191 chars * 4 bytes = 764 bytes, under the limit.
- 4Step 4: Use a hash or full-text index if prefix indexing is not suitable.
Frequently asked questions
Official documentation: https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html