Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,9 @@ CREATE TABLE `t_ds_workflow_instance` (
`restart_time` datetime DEFAULT NULL COMMENT 'workflow instance restart time',
PRIMARY KEY (`id`),
KEY `workflow_instance_index` (`workflow_definition_code`,`id`) USING BTREE,
KEY `start_time_index` (`start_time`,`end_time`) USING BTREE
KEY `start_time_index` (`start_time`,`end_time`) USING BTREE,
KEY `idx_project_code_start_time` (`project_code`, `start_time` DESC, `id` DESC) USING BTREE,
KEY `idx_workflow_definition_code_start_time` (`workflow_definition_code`, `start_time` DESC) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;

-- ----------------------------
Expand Down Expand Up @@ -937,7 +939,9 @@ CREATE TABLE `t_ds_task_instance` (
`memory_max` int(11) DEFAULT '-1' NOT NULL COMMENT 'MemoryMax(MB): -1:Infinity',
PRIMARY KEY (`id`),
KEY `workflow_instance_id` (`workflow_instance_id`) USING BTREE,
KEY `idx_code_version` (`task_code`, `task_definition_version`) USING BTREE
KEY `idx_code_version` (`task_code`, `task_definition_version`) USING BTREE,
KEY `idx_project_code_submit_time` (`project_code`, `submit_time` DESC) USING BTREE,
KEY `idx_project_code_start_time` (`project_code`, `start_time` DESC) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;

-- ----------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ CREATE TABLE t_ds_workflow_instance (

create index workflow_instance_index on t_ds_workflow_instance (workflow_definition_code,id);
create index start_time_index on t_ds_workflow_instance (start_time,end_time);
create index idx_project_code_start_time on t_ds_workflow_instance (project_code, start_time DESC, id DESC);
create index idx_workflow_definition_code_start_time on t_ds_workflow_instance (workflow_definition_code, start_time DESC);

--
-- Table structure for table t_ds_project
Expand Down Expand Up @@ -859,6 +861,9 @@ CREATE TABLE t_ds_task_instance (
) ;

create index idx_task_instance_code_version on t_ds_task_instance (task_code, task_definition_version);
create index idx_project_code_submit_time on t_ds_task_instance (project_code, submit_time DESC);
create index idx_workflow_instance_id on t_ds_task_instance (workflow_instance_id);
create index idx_project_code_start_time on t_ds_task_instance (project_code, start_time DESC);

--
-- Table structure for t_ds_task_instance_context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ CREATE TABLE IF NOT EXISTS `t_ds_serial_command` (
KEY `idx_workflow_instance_id` (`workflow_instance_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;

-- Add indexes for workflow instance and task instance
ALTER TABLE `t_ds_workflow_instance` ADD INDEX `idx_project_code_start_time` (`project_code`, `start_time` DESC, `id` DESC) USING BTREE;
ALTER TABLE `t_ds_workflow_instance` ADD INDEX `idx_workflow_definition_code_start_time` (`workflow_definition_code`, `start_time` DESC) USING BTREE;
ALTER TABLE `t_ds_task_instance` ADD INDEX `idx_project_code_submit_time` (`project_code`, `submit_time` DESC) USING BTREE;
ALTER TABLE `t_ds_task_instance` ADD INDEX `idx_project_code_start_time` (`project_code`, `start_time` DESC) USING BTREE;
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ COMMENT ON COLUMN "t_ds_serial_command"."state" IS 'state of the serial queue: 0
COMMENT ON COLUMN "t_ds_serial_command"."command" IS 'command json';
COMMENT ON COLUMN "t_ds_serial_command"."create_time" IS 'create time';
COMMENT ON COLUMN "t_ds_serial_command"."update_time" IS 'update time';

-- Add indexes for workflow instance and task instance
CREATE INDEX idx_project_code_start_time ON t_ds_workflow_instance (project_code, start_time DESC, id DESC);
CREATE INDEX idx_workflow_definition_code_start_time ON t_ds_workflow_instance (workflow_definition_code, start_time DESC);
CREATE INDEX idx_project_code_submit_time ON t_ds_task_instance (project_code, submit_time DESC);
CREATE INDEX idx_project_code_start_time ON t_ds_task_instance (project_code, start_time DESC);
Loading