@@ -232,7 +232,8 @@ CREATE TABLE IF NOT EXISTS vtap (
232232 team_id INTEGER ,
233233 expected_revision TEXT ,
234234 upgrade_package TEXT ,
235- lcuuid CHAR (64 )
235+ lcuuid CHAR (64 ),
236+ INDEX lcuuid_index(lcuuid)
236237) ENGINE= InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
237238TRUNCATE TABLE vtap;
238239
@@ -385,6 +386,7 @@ CREATE TABLE IF NOT EXISTS domain (
385386 synced_at DATETIME DEFAULT NULL ,
386387 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
387388 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
389+ INDEX team_id_index(team_id),
388390 UNIQUE INDEX lcuuid_index(lcuuid)
389391)ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
390392TRUNCATE TABLE domain;
@@ -408,6 +410,7 @@ CREATE TABLE IF NOT EXISTS sub_domain (
408410 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
409411 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
410412 deleted_at DATETIME DEFAULT NULL ,
413+ INDEX team_id_index(team_id),
411414 UNIQUE INDEX lcuuid_index(lcuuid)
412415)ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
413416TRUNCATE TABLE sub_domain;
@@ -488,8 +491,7 @@ CREATE TABLE IF NOT EXISTS vm (
488491 INDEX launch_server_index(launch_server),
489492 INDEX epc_id_index(epc_id),
490493 INDEX az_index(az),
491- INDEX region_index(region),
492- INDEX id_index(` id` )
494+ INDEX region_index(region)
493495)ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
494496TRUNCATE TABLE vm;
495497
@@ -594,7 +596,8 @@ CREATE TABLE IF NOT EXISTS vl2_net (
594596 lcuuid CHAR (64 ) DEFAULT ' ' ,
595597 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
596598 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
597- PRIMARY KEY (id)
599+ PRIMARY KEY (id),
600+ INDEX vl2id_index(vl2id)
598601) ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
599602TRUNCATE TABLE vl2_net;
600603
@@ -672,7 +675,9 @@ CREATE TABLE IF NOT EXISTS vinterface (
672675 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
673676 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
674677 INDEX epc_id_index(epc_id),
675- INDEX mac_index(mac)
678+ INDEX mac_index(mac),
679+ INDEX devicetype_index(devicetype),
680+ INDEX lcuuid_index(lcuuid)
676681)ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
677682TRUNCATE TABLE vinterface;
678683
@@ -693,7 +698,8 @@ CREATE TABLE IF NOT EXISTS vinterface_ip (
693698 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
694699 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
695700 INDEX ip_index(` ip` ),
696- INDEX vifid_index(` vifid` )
701+ INDEX vifid_index(` vifid` ),
702+ INDEX lcuuid_index(lcuuid)
697703) ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
698704TRUNCATE TABLE vinterface_ip;
699705
@@ -715,7 +721,8 @@ CREATE TABLE IF NOT EXISTS ip_resource (
715721 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
716722 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
717723 INDEX ip_index(` ip` ),
718- INDEX vifid_index(` vifid` )
724+ INDEX vifid_index(` vifid` ),
725+ INDEX lcuuid_index(lcuuid)
719726)ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
720727TRUNCATE TABLE ip_resource;
721728
@@ -985,7 +992,8 @@ CREATE TABLE IF NOT EXISTS vm_pod_node_connection (
985992 sub_domain CHAR (64 ) DEFAULT ' ' ,
986993 lcuuid CHAR (64 ) DEFAULT ' ' ,
987994 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
988- updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP
995+ updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
996+ INDEX pod_node_id_index(pod_node_id)
989997) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
990998TRUNCATE TABLE vm_pod_node_connection;
991999
@@ -1101,7 +1109,8 @@ CREATE TABLE IF NOT EXISTS pod_service_port (
11011109 lcuuid CHAR (64 ),
11021110 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
11031111 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
1104- INDEX pod_service_id_index(pod_service_id)
1112+ INDEX pod_service_id_index(pod_service_id),
1113+ INDEX lcuuid_index(lcuuid)
11051114) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
11061115TRUNCATE TABLE pod_service_port;
11071116
@@ -1130,7 +1139,8 @@ CREATE TABLE IF NOT EXISTS pod_group (
11301139 deleted_at DATETIME DEFAULT NULL ,
11311140 INDEX pod_namespace_id_index(pod_namespace_id),
11321141 INDEX pod_cluster_id_index(pod_cluster_id),
1133- INDEX lcuuid_index(lcuuid)
1142+ INDEX lcuuid_index(lcuuid),
1143+ INDEX deleted_at_index(deleted_at)
11341144) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
11351145TRUNCATE TABLE pod_group;
11361146
@@ -1168,7 +1178,8 @@ CREATE TABLE IF NOT EXISTS pod_rs (
11681178 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
11691179 deleted_at DATETIME DEFAULT NULL ,
11701180 INDEX pod_group_id_index(pod_group_id),
1171- INDEX pod_namespace_id_index(pod_namespace_id)
1181+ INDEX pod_namespace_id_index(pod_namespace_id),
1182+ INDEX lcuuid_index(lcuuid)
11721183) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
11731184TRUNCATE TABLE pod_rs;
11741185
@@ -1207,7 +1218,10 @@ CREATE TABLE IF NOT EXISTS pod (
12071218 INDEX az_index(az),
12081219 INDEX region_index(region),
12091220 INDEX domain_index(domain),
1210- INDEX lcuuid_index(lcuuid)
1221+ INDEX lcuuid_index(lcuuid),
1222+ INDEX pod_ns_created_at_index(pod_namespace_id, created_at),
1223+ INDEX pod_cluster_created_at_index(pod_cluster_id, created_at),
1224+ INDEX deleted_at_index(deleted_at)
12111225) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
12121226TRUNCATE TABLE pod;
12131227
@@ -1274,7 +1288,8 @@ CREATE TABLE IF NOT EXISTS process (
12741288 deleted_at DATETIME DEFAULT NULL ,
12751289 INDEX domain_sub_domain_gid_updated_at_index(domain, sub_domain, gid, updated_at DESC ),
12761290 INDEX deleted_at_index(deleted_at),
1277- INDEX lcuuid_index(lcuuid)
1291+ INDEX lcuuid_index(lcuuid),
1292+ INDEX vtap_id_index(vtap_id)
12781293) ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
12791294TRUNCATE TABLE process;
12801295
@@ -1743,7 +1758,8 @@ CREATE TABLE IF NOT EXISTS ch_os_app_tag (
17431758 ` sub_domain_id` INTEGER ,
17441759 ` updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
17451760 PRIMARY KEY (` id` , ` key` ),
1746- INDEX updated_at_index(` updated_at` )
1761+ INDEX updated_at_index(` updated_at` ),
1762+ INDEX domain_sub_domain_id_updated_at_index(domain_id, sub_domain_id, id, updated_at ASC )
17471763)ENGINE= innodb DEFAULT CHARSET= utf8;
17481764TRUNCATE TABLE ch_os_app_tag;
17491765
0 commit comments