gpt4 book ai didi

mysql - 无法在mysql上分区表

转载 作者:行者123 更新时间:2023-11-29 05:07:04 25 4
gpt4 key购买 nike

当我运行 alter table 对 innodb 表进行分区时,我在 Mysql 5.7 上遇到了这个错误:

Foreign keys are not yet supported in conjunction with partitioning

知道我已经删除了这个表的外键,并且删除了这个表的id所在的外键

现在这是我的表架构:

| record | CREATE TABLE `record` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`altitude` smallint(6) DEFAULT NULL,
`counter` double DEFAULT NULL,
`datetime` datetime NOT NULL,
`details` longtext,
`deviation` smallint(6) DEFAULT NULL,
`engine` tinyint(1) DEFAULT NULL,
`event` smallint(6) DEFAULT NULL,
`fuel_level` double DEFAULT NULL,
`gsm_level` int(11) DEFAULT NULL,
`latitude` double NOT NULL,
`longitude` double NOT NULL,
`satellite` smallint(6) DEFAULT NULL,
`speed` smallint(6) DEFAULT NULL,
`time` time NOT NULL,
`treated` tinyint(1) NOT NULL DEFAULT '0',
`id_driver` bigint(20) DEFAULT NULL,
`id_vehicle_device` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_ai9y9d52lx1xvtaiv3w0x60a5` (`id_driver`),
KEY `FK_ilwlg0mt87bxyemx4tov1elni` (`id_vehicle_device`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |

最佳答案

来自 Restrictions and Limitations on Partitioning :

Foreign keys not supported for partitioned InnoDB tables. Partitioned tables using the InnoDB storage engine do not support foreign keys. More specifically, this means that the following two statements are true:

  • No definition of an InnoDB table employing user-defined partitioning may contain foreign key references; no InnoDB table whose definition contains foreign key references may be partitioned.

  • No InnoDB table definition may contain a foreign key reference to a user-partitioned table; no InnoDB table with user-defined partitioning may contain columns referenced by foreign keys.

关于mysql - 无法在mysql上分区表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45962503/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com