@@ -230,7 +230,8 @@ CREATE TABLE IF NOT EXISTS vtap (
230230 team_id INTEGER ,
231231 expected_revision TEXT ,
232232 upgrade_package TEXT ,
233- lcuuid CHAR (64 )
233+ lcuuid CHAR (64 ),
234+ INDEX lcuuid_index(lcuuid)
234235) ENGINE= InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
235236TRUNCATE TABLE vtap;
236237
@@ -382,6 +383,7 @@ CREATE TABLE IF NOT EXISTS domain (
382383 synced_at DATETIME DEFAULT NULL ,
383384 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
384385 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
386+ INDEX team_id_index(team_id),
385387 UNIQUE INDEX lcuuid_index(lcuuid)
386388)ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
387389TRUNCATE TABLE domain;
@@ -404,6 +406,7 @@ CREATE TABLE IF NOT EXISTS sub_domain (
404406 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
405407 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
406408 deleted_at DATETIME DEFAULT NULL ,
409+ INDEX team_id_index(team_id),
407410 UNIQUE INDEX lcuuid_index(lcuuid)
408411)ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
409412TRUNCATE TABLE sub_domain;
@@ -484,8 +487,7 @@ CREATE TABLE IF NOT EXISTS vm (
484487 INDEX launch_server_index(launch_server),
485488 INDEX epc_id_index(epc_id),
486489 INDEX az_index(az),
487- INDEX region_index(region),
488- INDEX id_index(` id` )
490+ INDEX region_index(region)
489491)ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
490492TRUNCATE TABLE vm;
491493
@@ -590,7 +592,8 @@ CREATE TABLE IF NOT EXISTS vl2_net (
590592 lcuuid CHAR (64 ) DEFAULT ' ' ,
591593 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
592594 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
593- PRIMARY KEY (id)
595+ PRIMARY KEY (id),
596+ INDEX vl2id_index(vl2id)
594597) ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
595598TRUNCATE TABLE vl2_net;
596599
@@ -668,7 +671,9 @@ CREATE TABLE IF NOT EXISTS vinterface (
668671 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
669672 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
670673 INDEX epc_id_index(epc_id),
671- INDEX mac_index(mac)
674+ INDEX mac_index(mac),
675+ INDEX devicetype_index(devicetype),
676+ INDEX lcuuid_index(lcuuid)
672677)ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
673678TRUNCATE TABLE vinterface;
674679
@@ -689,7 +694,8 @@ CREATE TABLE IF NOT EXISTS vinterface_ip (
689694 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
690695 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
691696 INDEX ip_index(` ip` ),
692- INDEX vifid_index(` vifid` )
697+ INDEX vifid_index(` vifid` ),
698+ INDEX lcuuid_index(lcuuid)
693699) ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
694700TRUNCATE TABLE vinterface_ip;
695701
@@ -711,7 +717,8 @@ CREATE TABLE IF NOT EXISTS ip_resource (
711717 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
712718 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
713719 INDEX ip_index(` ip` ),
714- INDEX vifid_index(` vifid` )
720+ INDEX vifid_index(` vifid` ),
721+ INDEX lcuuid_index(lcuuid)
715722)ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
716723TRUNCATE TABLE ip_resource;
717724
@@ -979,7 +986,8 @@ CREATE TABLE IF NOT EXISTS vm_pod_node_connection (
979986 sub_domain CHAR (64 ) DEFAULT ' ' ,
980987 lcuuid CHAR (64 ) DEFAULT ' ' ,
981988 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
982- updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP
989+ updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
990+ INDEX pod_node_id_index(pod_node_id)
983991) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
984992TRUNCATE TABLE vm_pod_node_connection;
985993
@@ -1095,7 +1103,8 @@ CREATE TABLE IF NOT EXISTS pod_service_port (
10951103 lcuuid CHAR (64 ),
10961104 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
10971105 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
1098- INDEX pod_service_id_index(pod_service_id)
1106+ INDEX pod_service_id_index(pod_service_id),
1107+ INDEX lcuuid_index(lcuuid)
10991108) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
11001109TRUNCATE TABLE pod_service_port;
11011110
@@ -1124,7 +1133,8 @@ CREATE TABLE IF NOT EXISTS pod_group (
11241133 deleted_at DATETIME DEFAULT NULL ,
11251134 INDEX pod_namespace_id_index(pod_namespace_id),
11261135 INDEX pod_cluster_id_index(pod_cluster_id),
1127- INDEX lcuuid_index(lcuuid)
1136+ INDEX lcuuid_index(lcuuid),
1137+ INDEX deleted_at_index(deleted_at)
11281138) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
11291139TRUNCATE TABLE pod_group;
11301140
@@ -1162,7 +1172,8 @@ CREATE TABLE IF NOT EXISTS pod_rs (
11621172 updated_at DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
11631173 deleted_at DATETIME DEFAULT NULL ,
11641174 INDEX pod_group_id_index(pod_group_id),
1165- INDEX pod_namespace_id_index(pod_namespace_id)
1175+ INDEX pod_namespace_id_index(pod_namespace_id),
1176+ INDEX lcuuid_index(lcuuid)
11661177) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
11671178TRUNCATE TABLE pod_rs;
11681179
@@ -1201,7 +1212,10 @@ CREATE TABLE IF NOT EXISTS pod (
12011212 INDEX az_index(az),
12021213 INDEX region_index(region),
12031214 INDEX domain_index(domain),
1204- INDEX lcuuid_index(lcuuid)
1215+ INDEX lcuuid_index(lcuuid),
1216+ INDEX pod_ns_created_at_index(pod_namespace_id, created_at),
1217+ INDEX pod_cluster_created_at_index(pod_cluster_id, created_at),
1218+ INDEX deleted_at_index(deleted_at)
12051219) ENGINE= innodb AUTO_INCREMENT= 1 DEFAULT CHARSET= utf8;
12061220TRUNCATE TABLE pod;
12071221
@@ -1268,7 +1282,8 @@ CREATE TABLE IF NOT EXISTS process (
12681282 deleted_at DATETIME DEFAULT NULL ,
12691283 INDEX domain_sub_domain_gid_updated_at_index(domain, sub_domain, gid, updated_at DESC ),
12701284 INDEX deleted_at_index(deleted_at),
1271- INDEX lcuuid_index(lcuuid)
1285+ INDEX lcuuid_index(lcuuid),
1286+ INDEX vtap_id_index(vtap_id)
12721287) ENGINE= innodb DEFAULT CHARSET= utf8 AUTO_INCREMENT= 1 ;
12731288TRUNCATE TABLE process;
12741289
@@ -1729,7 +1744,8 @@ CREATE TABLE IF NOT EXISTS ch_os_app_tag (
17291744 ` sub_domain_id` INTEGER ,
17301745 ` updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
17311746 PRIMARY KEY (` id` , ` key` ),
1732- INDEX updated_at_index(` updated_at` )
1747+ INDEX updated_at_index(` updated_at` ),
1748+ INDEX domain_sub_domain_id_updated_at_index(domain_id, sub_domain_id, id, updated_at ASC )
17331749)ENGINE= innodb DEFAULT CHARSET= utf8;
17341750TRUNCATE TABLE ch_os_app_tag;
17351751
0 commit comments