Skip to content

[Improvement-18437][API] Add index idx_project_submit_time for queryTaskInstanceListPaging - #18438

Merged
SbloodyS merged 1 commit into
apache:devfrom
njnu-seafish:Improvement-18437
Jul 23, 2026
Merged

[Improvement-18437][API] Add index idx_project_submit_time for queryTaskInstanceListPaging#18438
SbloodyS merged 1 commit into
apache:devfrom
njnu-seafish:Improvement-18437

Conversation

@njnu-seafish

@njnu-seafish njnu-seafish commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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,

ALTERTABLEt_ds_task_instance` ADD INDEX idx_project_submit_time (project_code ASC, submit_time DESC);

----- 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

@SbloodyS SbloodyS added the improvement make more easy to user or prompt friendly label Jul 23, 2026
@SbloodyS SbloodyS added this to the 3.5.0 milestone Jul 23, 2026

@SbloodyS SbloodyS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend improvement make more easy to user or prompt friendly

Projects

None yet

2 participants