[Improvement-18437][API] Add index idx_project_submit_time for queryTaskInstanceListPaging - #18438
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was this PR generated or assisted by AI?
NO
Purpose of the pull request
close #18437
Brief change log
The queryStreamTaskInstanceListPaging interface is rarely used, so we won't add extra indexes for it. After all, adding indexes does come with side effects.
However, since the queryTaskInstanceListPaging interface for batch tasks is frequently used, we have added the index idx_project_submit_time (project_code ASC, submit_time DESC) to accelerate the queries.
Verify this pull request
After adding the following index to the database,
----- The execution of the following SQL takes about 0.073 seconds
SELECT id, NAME, task_type, workflow_instance_id, workflow_instance_name, project_code, task_code, task_definition_version, state, submit_time,
start_time, end_time, HOST, execute_path, log_path, alert_flag, retry_times, pid, app_link,
flag, retry_interval, max_retry_times, task_instance_priority, worker_group, environment_code, executor_id, executor_name,
first_submit_time, delay_time, task_params, var_pool, dry_run, task_group_id, cpu_quota, memory_max, task_execute_type
FROM t_ds_task_instance
WHERE project_code = 175568922056192
ORDER BY submit_time DESC
LIMIT 10 OFFSET 0;
----- The execution of the following SQL takes about 0.074 seconds
SELECT id, NAME, task_type, workflow_instance_id, workflow_instance_name, project_code, task_code, task_definition_version, state, submit_time,
start_time, end_time, HOST, execute_path, log_path, alert_flag, retry_times, pid, app_link,
flag, retry_interval, max_retry_times, task_instance_priority, worker_group, environment_code, executor_id, executor_name,
first_submit_time, delay_time, task_params, var_pool, dry_run, task_group_id, cpu_quota, memory_max, task_execute_type
FROM t_ds_task_instance
WHERE project_code = 175568922056192
AND start_time >= '2026-07-20 00:00:00'
AND start_time <= '2026-07-23 23:59:59'
ORDER BY submit_time DESC
LIMIT 10 OFFSET 0;
Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md