本文介绍了索引列大小太大.最大列大小为767个字节. -对于INT数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道innodb对密钥大小施加了限制,但是一个INT?

I am aware innodb imposes a limit on key size, but an INT?

    CREATE TABLE IF NOT EXISTS  `db`.`TAGS` (

 `tag_id` INT( 11 ) NOT NULL ,
 `tag_text` VARCHAR( 700 ) NULL ,
 `date_added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
 `xxx_id` INT( 11 ) NOT NULL COMMENT  'This is for ease of reference lookup later',
 `user_id` INT( 11 ) NOT NULL ,
 `TAG_FACT_RELATION_relation_id` INT NOT NULL ,
PRIMARY KEY (  `tag_id` ) ,
UNIQUE INDEX  `tag_UNIQUE` (  `tag_text` ASC ) ,
UNIQUE INDEX  `tag_id_UNIQUE` (  `tag_id` ASC ) ,
INDEX  `fk_TAGS_TAG_FACT_RELATION1_idx` (  `TAG_FACT_RELATION_relation_id` ASC ) ,
CONSTRAINT  `fk_TAGS_TAG_FACT_RELATION1` FOREIGN KEY (  `TAG_FACT_RELATION_relation_id` ) REFERENCES  `meepl`.`TAG_FACT_RELATION` (
`relation_id`
) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE = INNODB;

有错误说:

#1709 - Index column size too large. The maximum column size is 767 bytes.

有什么想法吗?多年来,我一直在研究数据类型.

Any ideas? I have been muching around with data types for ages.

推荐答案

有点晚了,但是我遇到了类似的问题.

A bit late but I had a similar issue.

您的tag_text列具有UNIQUE_INDEX,这就是引起问题的原因,而不是INT数据类型.

Your tag_text column has a UNIQUE_INDEX and that is what is causing the issue, not the INT datatype.

通过启用innodb_large_prefix设置,更改MySql安装以启用更大的索引列.

Change your MySql installation to enable larger index columns by enabling the innodb_large_prefix setting.

请参见 http://dev.mysql.com/doc /refman/5.5/en/innodb-restrictions.html

这篇关于索引列大小太大.最大列大小为767个字节. -对于INT数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 12:20