From 117dde37b344c36ff4d64c59984e9a2b1c626e1a Mon Sep 17 00:00:00 2001 From: xiangzihao <460888207@qq.com> Date: Tue, 3 Dec 2024 13:54:55 +0800 Subject: [PATCH] [Improvement-16867] Add project_code index on t_ds_workflow_definition (#16869) --- .../src/main/resources/sql/dolphinscheduler_mysql.sql | 6 ++++-- .../src/main/resources/sql/dolphinscheduler_postgresql.sql | 2 ++ .../sql/upgrade/3.3.0_schema/mysql/dolphinscheduler_ddl.sql | 3 +++ .../3.3.0_schema/postgresql/dolphinscheduler_ddl.sql | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql index 19cc8efaf2..4a63f32e8e 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 bc6cf3d731..f2a7aae44b 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 fb87d88ee6..c78c33ea8a 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 b9fe362c8d..31eaf8f645 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);