Browse Source

[imporve] Add index to table t_ds_relation_process_instance (#10461)

3.1.0-release
SmallProgrammer 2 years ago committed by GitHub
parent
commit
7aa9fa4965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
  2. 2
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
  3. 2
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.0.0_schema/mysql/dolphinscheduler_ddl.sql
  4. 6
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.0.0_schema/postgresql/dolphinscheduler_ddl.sql

4
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql

@ -694,7 +694,9 @@ CREATE TABLE `t_ds_relation_process_instance` (
`parent_process_instance_id` int(11) DEFAULT NULL COMMENT 'parent process instance id', `parent_process_instance_id` int(11) DEFAULT NULL COMMENT 'parent process instance id',
`parent_task_instance_id` int(11) DEFAULT NULL COMMENT 'parent process instance id', `parent_task_instance_id` int(11) DEFAULT NULL COMMENT 'parent process instance id',
`process_instance_id` int(11) DEFAULT NULL COMMENT 'child process instance id', `process_instance_id` int(11) DEFAULT NULL COMMENT 'child process instance id',
PRIMARY KEY (`id`) PRIMARY KEY (`id`),
KEY `idx_parent_process_task` (`parent_process_instance_id`,`parent_task_instance_id`) ,
KEY `idx_process_instance_id` (`process_instance_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- ---------------------------- -- ----------------------------

2
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql

@ -615,6 +615,8 @@ CREATE TABLE t_ds_relation_process_instance (
process_instance_id int DEFAULT NULL , process_instance_id int DEFAULT NULL ,
PRIMARY KEY (id) PRIMARY KEY (id)
) ; ) ;
create index idx_relation_process_instance_parent_process_task on t_ds_relation_process_instance (parent_process_instance_id, parent_task_instance_id);
create index idx_relation_process_instance_process_instance_id on t_ds_relation_process_instance (process_instance_id);
-- --

2
dolphinscheduler-dao/src/main/resources/sql/upgrade/3.0.0_schema/mysql/dolphinscheduler_ddl.sql

@ -67,6 +67,8 @@ ALTER TABLE `t_ds_process_task_relation` ADD KEY `idx_code` (`project_code`, `pr
ALTER TABLE `t_ds_process_task_relation` ADD KEY `idx_pre_task_code_version` (`pre_task_code`,`pre_task_version`); ALTER TABLE `t_ds_process_task_relation` ADD KEY `idx_pre_task_code_version` (`pre_task_code`,`pre_task_version`);
ALTER TABLE `t_ds_process_task_relation` ADD KEY `idx_post_task_code_version` (`post_task_code`,`post_task_version`); ALTER TABLE `t_ds_process_task_relation` ADD KEY `idx_post_task_code_version` (`post_task_code`,`post_task_version`);
ALTER TABLE `t_ds_process_task_relation_log` ADD KEY `idx_process_code_version` (`process_definition_code`,`process_definition_version`) USING BTREE; ALTER TABLE `t_ds_process_task_relation_log` ADD KEY `idx_process_code_version` (`process_definition_code`,`process_definition_version`) USING BTREE;
ALTER TABLE `t_ds_relation_process_instance` ADD KEY `idx_parent_process_task`( `parent_process_instance_id`, `parent_task_instance_id` );
ALTER TABLE `t_ds_relation_process_instance` ADD KEY `idx_process_instance_id`(`process_instance_id`);
ALTER TABLE `t_ds_task_definition_log` ADD INDEX `idx_project_code` (`project_code`) USING BTREE; ALTER TABLE `t_ds_task_definition_log` ADD INDEX `idx_project_code` (`project_code`) USING BTREE;
ALTER TABLE `t_ds_task_definition_log` ADD INDEX `idx_code_version` (`code`,`version`) USING BTREE; ALTER TABLE `t_ds_task_definition_log` ADD INDEX `idx_code_version` (`code`,`version`) USING BTREE;

6
dolphinscheduler-dao/src/main/resources/sql/upgrade/3.0.0_schema/postgresql/dolphinscheduler_ddl.sql

@ -89,6 +89,12 @@ EXECUTE 'CREATE INDEX IF NOT EXISTS process_task_relation_log_idx_project_code_p
EXECUTE 'DROP INDEX IF EXISTS "idx_task_definition_log_code_version"'; EXECUTE 'DROP INDEX IF EXISTS "idx_task_definition_log_code_version"';
EXECUTE 'CREATE INDEX IF NOT EXISTS idx_task_definition_log_code_version ON ' || quote_ident(v_schema) ||'.t_ds_task_definition_log USING Btree("code","version")'; EXECUTE 'CREATE INDEX IF NOT EXISTS idx_task_definition_log_code_version ON ' || quote_ident(v_schema) ||'.t_ds_task_definition_log USING Btree("code","version")';
EXECUTE 'DROP INDEX IF EXISTS "idx_relation_process_instance_parent_process_task"';
EXECUTE 'CREATE INDEX IF NOT EXISTS idx_relation_process_instance_parent_process_task ON ' || quote_ident(v_schema) ||'.t_ds_relation_process_instance USING Btree("parent_process_instance_id","parent_task_instance_id")';
EXECUTE 'DROP INDEX IF EXISTS "idx_relation_process_instance_process_instance_id"';
EXECUTE 'CREATE INDEX IF NOT EXISTS idx_relation_process_instance_process_instance_id ON ' || quote_ident(v_schema) ||'.t_ds_relation_process_instance USING Btree("process_instance_id")';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_user ADD COLUMN IF NOT EXISTS "time_zone" varchar(32) DEFAULT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_user ADD COLUMN IF NOT EXISTS "time_zone" varchar(32) DEFAULT NULL';
EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_alert ADD COLUMN IF NOT EXISTS "warning_type" int DEFAULT 2'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_alert ADD COLUMN IF NOT EXISTS "warning_type" int DEFAULT 2';

Loading…
Cancel
Save