Bootstrap

mysql+取消索引设置_mysql添加删除索引

mysql> show create table table_test;

+---------------------------------------+---------------------------+

| Table | Create Table |

+---------------------------------------+---------------------------+

| table_test | CREATE TABLE `table_test` (

`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',

`activity_id` varchar(20) NOT NULL COMMENT '娲诲姩ID',

`store_code` varchar(100) NOT NULL COMMENT '娲诲姩鍚嶇О',

`generation_date` date DEFAULT NULL COMMENT '鐢熸垚鏃ユ湡,鏍煎紡锛歽yyy-MM-dd',

`ordercon_num` bigint(20) DEFAULT '0' COMMENT '璁㈠崟杞寲浜烘暟',

`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',

`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',

`delete_flag` varchar(1) DEFAULT '1' COMMENT '鐘舵€?1-鍚敤锛?-鍒犻櫎',

PRIMARY KEY (`id`),

UNIQUE KEY `uk_activityid_date` (`activity_id`,`generation_date`) USING BTREE,

KEY `idx_storecode` (`store_code`) USING BTREE

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='搴楅摵缁村害澶╄〃' |

+---------------------------------------+---------------------------

乱码正好算加密了~

删除联合主键索引:

ALTER TABLE table_test DROP INDEX `uk_activityid_date`;

添加索引:

ALTER TABLE table_test ADD INDEX `idx_activityid` (`activity_id`) USING BTREE;

;