CREATE TABLE IF NOT EXISTS `church` (
`church_id` INT(11) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(40) NOT NULL ,
`city_id` SMALLINT(4) UNSIGNED ZEROFILL NOT NULL ,
`validated` TINYINT(1) NULL ,
PRIMARY KEY (`church_id`) ,
INDEX `church.city_id-city.city_id_idx` (`city_id` ASC) ,
UNIQUE INDEX `church-city_id` (`name` ASC, `city_id` ASC) ,
CONSTRAINT `church.city_id-city.city_id`
FOREIGN KEY (`city_id` )
REFERENCES `city` (`city_id` )
ON DELETE RESTRICT
ON UPDATE RESTRICT)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
我的本地主机(笔记本电脑)上有这张桌子church
。当我对其进行插入时(它10
现在有行),需要 160 毫秒。
- Church_id 在其他表中用作外键。
- name 和 city_id 一起应该是唯一的。
- city_id 是外键
这不是很多,我做错了什么吗?