How to enable large index in MariaDB 10?

After the steps provided by @Rick :

SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_large_prefix=1;
-- logout & login (to get the global values);

I changed last step to

SET GLOBAL innodb_default_row_format=DYNAMIC;

So far so good.


It requires more than just those two settings...

SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_large_prefix=1;
logout & login (to get the global values);
ALTER TABLE tbl ROW_FORMAT=DYNAMIC;  -- or COMPRESSED

Perhaps all you need is to add ROW_FORMAT=... to your CREATE TABLE.

These instructions are needed for 5.6.3 up to 5.7.7. Beginning with 5.7.7, the system defaults correctly to handle larger fields.

Alternatively, you could use a "prefix" index:

INDEX(column(191))

(But prefix indexing is flawed in many ways.)

"If the server later creates a higher table format, innodb_file_format_max is set to that value" implies that that setting is not an issue.


innodb_large_prefix only applies to COMPRESSED and DYNAMIC row formats.

MariaDB 10.0 and 10.1 have InnoDB 5.6, which by default creates tables with ROW_FORMAT=Compact (even if innodb_file_format is set to Barracuda). So, to use large prefixes, you need to specify the row format explicitly. Same is true for MySQL 5.6.

InnoDB 5.7 by default creates the table with ROW_FORMAT=DYNAMIC, which is why the same CREATE relying on innodb_large_prefix works in MySQL 5.7 and MariaDB 10.2 without any additional clauses.