diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql index 19cc8efaf284..4a63f32e8e43 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql @@ -427,7 +427,8 @@ CREATE TABLE `t_ds_workflow_definition` ( `create_time` datetime NOT NULL COMMENT 'create time', `update_time` datetime NOT NULL COMMENT 'update time', PRIMARY KEY (`id`,`code`), - UNIQUE KEY `workflow_unique` (`name`,`project_code`) USING BTREE + UNIQUE KEY `workflow_unique` (`name`,`project_code`) USING BTREE, + KEY `idx_project_code` (`project_code`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin; -- ---------------------------- @@ -454,7 +455,8 @@ CREATE TABLE `t_ds_workflow_definition_log` ( `create_time` datetime NOT NULL COMMENT 'create time', `update_time` datetime NOT NULL COMMENT 'update time', PRIMARY KEY (`id`), - UNIQUE KEY `uniq_idx_code_version` (`code`,`version`) USING BTREE + UNIQUE KEY `uniq_idx_code_version` (`code`,`version`) USING BTREE, + KEY `idx_project_code` (`project_code`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin; -- ---------------------------- diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql index bc6cf3d731b1..f2a7aae44be3 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql @@ -350,6 +350,7 @@ CREATE TABLE t_ds_workflow_definition ( ) ; create index workflow_definition_index on t_ds_workflow_definition (code,id); +create index workflow_definition_index_project_code on t_ds_workflow_definition (project_code); -- -- Table structure for table t_ds_workflow_definition_log @@ -379,6 +380,7 @@ CREATE TABLE t_ds_workflow_definition_log ( ) ; create UNIQUE index uniq_idx_code_version on t_ds_workflow_definition_log (code,version); +create index workflow_definition_log_index_project_code on t_ds_workflow_definition_log (project_code); -- -- Table structure for table t_ds_task_definition diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/mysql/dolphinscheduler_ddl.sql index fb87d88ee66f..c78c33ea8ae3 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/mysql/dolphinscheduler_ddl.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/mysql/dolphinscheduler_ddl.sql @@ -222,3 +222,6 @@ d// delimiter ; CALL drop_data_quality_tables; DROP PROCEDURE drop_data_quality_tables; + +ALTER TABLE `t_ds_workflow_definition` ADD KEY `idx_project_code` (`project_code`) USING BTREE; +ALTER TABLE `t_ds_workflow_definition_log` ADD KEY `idx_project_code` (`project_code`) USING BTREE; diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/postgresql/dolphinscheduler_ddl.sql index b9fe362c8d14..31eaf8f645cf 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/postgresql/dolphinscheduler_ddl.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.3.0_schema/postgresql/dolphinscheduler_ddl.sql @@ -225,3 +225,6 @@ d// select drop_data_quality_tables(); DROP FUNCTION IF EXISTS drop_data_quality_tables(); + +create index workflow_definition_index_project_code on t_ds_workflow_definition (project_code); +create index workflow_definition_log_index_project_code on t_ds_workflow_definition_log (project_code);