用Hibernate Tool 通过 Ant 执行 hbm2ddl 导出的SQL语句大体如下:create table ColumnLayout (_id varchar(36) not null unique, _version integer, _active bit not null, _enabled bit not null, _identifier varchar(255), _name varchar(255), _order integer not null, _visible bit not null, _width integer not null, tablelayout_id varchar(36), sort_idx integer, primary key (_id)) ENGINE=InnoDB;alter table ColumnLayout add index fk_tblLayout2colLayout (tablelayout_id), add constraint fk_tblLayout2colLayout foreign key (tablelayout_id) references TableLayout (_id);通过mysqldump导出的语句如下CREATE TABLE `columnlayout` (
`_id` varchar(36) COLLATE utf8_bin NOT NULL,
`_version` int(11) DEFAULT NULL,
`_active` bit(1) NOT NULL,
`_enabled` bit(1) NOT NULL,
`_identifier` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`_name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`_order` int(11) NOT NULL,
`_visible` bit(1) NOT NULL,
`_width` int(11) NOT NULL,
`tablelayout_id` varchar(36) COLLATE utf8_bin DEFAULT NULL,
`sort_idx` int(11) DEFAULT NULL,
PRIMARY KEY (`_id`),
UNIQUE KEY `_id` (`_id`),
KEY `fk_tblLayout2colLayout` (`tablelayout_id`),
CONSTRAINT `fk_tblLayout2colLayout` FOREIGN KEY (`tablelayout_id`) REFERENCES `tablelayout` (`_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;经过测试,ant导出的语句执行效率太低,是由于alter table耗时太久。请问有什么办法可以让速度提高?谢谢
`_id` varchar(36) COLLATE utf8_bin NOT NULL,
`_version` int(11) DEFAULT NULL,
`_active` bit(1) NOT NULL,
`_enabled` bit(1) NOT NULL,
`_identifier` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`_name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`_order` int(11) NOT NULL,
`_visible` bit(1) NOT NULL,
`_width` int(11) NOT NULL,
`tablelayout_id` varchar(36) COLLATE utf8_bin DEFAULT NULL,
`sort_idx` int(11) DEFAULT NULL,
PRIMARY KEY (`_id`),
UNIQUE KEY `_id` (`_id`),
KEY `fk_tblLayout2colLayout` (`tablelayout_id`),
CONSTRAINT `fk_tblLayout2colLayout` FOREIGN KEY (`tablelayout_id`) REFERENCES `tablelayout` (`_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;经过测试,ant导出的语句执行效率太低,是由于alter table耗时太久。请问有什么办法可以让速度提高?谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货