作为 Invision 社区论坛升级过程的一部分,我正在尝试向现有表添加索引。该数据库托管在兼容 MySQL 5.6 的 AWS Aurora Serverless 中。但是,每次,我都会收到错误:
ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.
以下是有关表和架构的详细信息:
+---------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+--------------------+----------+--------------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+---------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+--------------------+----------+--------------------+---------+
| ibf_core_tags | InnoDB | 10 | Dynamic | 36862 | 299 | 11026432 | 0 | 13189120 | 4194304 | 95183 | NULL | NULL | NULL | utf8mb4_unicode_ci | NULL | row_format=DYNAMIC | |
+---------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------+-------------+------------+--------------------+----------+--------------------+---------+
+--------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+----------------+
| tag_id | bigint(20) | NO | PRI | NULL | auto_increment |
| tag_aai_lookup | char(32) | NO | MUL | | |
| tag_aap_lookup | char(32) | NO | MUL | | |
| tag_meta_app | varchar(200) | NO | MUL | | |
| tag_meta_area | varchar(200) | NO | | | |
| tag_meta_id | int(10) | NO | | 0 | |
| tag_meta_parent_id | int(10) | NO | | 0 | |
| tag_member_id | int(10) | NO | MUL | 0 | |
| tag_added | int(10) | NO | MUL | 0 | |
| tag_prefix | int(1) | NO | | 0 | |
| tag_text | varchar(255) | YES | | NULL | |
+--------------------+--------------+------+-----+---------+----------------+
表的默认字符集是 utf8mb4,innodb_large_prefix
设置是ON
.
我正在尝试做的操作是:
ALTER TABLE `ibf_core_tags` ADD KEY `tag_text` (`tag_text`(191));
我认为 191 * 4 = 764,小于它说我超过的 767 字节值。这是 Aurora Serverless 中的错误吗?有没有办法解决这个问题?我尝试将表更改为 MyISAM 以添加索引,但当我尝试这样做时,我实际上得到了同样的错误。
使用 MySQL 5.6 的本地安装,我能够在同一个数据库上运行这个 ALTER TABLE 查询,所以我不确定为什么 Aurora Serverless 有什么不同。
我最终在一个非无服务器 Aurora 实例上尝试了这个并且遇到了同样的问题。