darkz1984 opened a new pull request, #12826:
URL: https://github.com/apache/dolphinscheduler/pull/12826

   ## Purpose of the pull request
   Speed Up delete process from Web UI
   
   ## Brief change log
   add an index on table t_ds_task_instance
   
   ```
   create index idx_task_instance_process_instance_flag on t_ds_task_instance 
(process_instance_id, flag);
   ```
   
   I use postgresql as my dolphinscheduler meta data base
   
   Because I have some process run in each 5 minutes , so lead much process 
instance and task instance in the database , the most top instance of  task 
node may reach 2000 and the total t_ds_task_instance table hold nearly 1000000 
records in it.
   
   I had try delete process or process instance from the web ui. But I found it 
too slow and lead my postgresql server cpu usage too high, and cost nearly 
about one hours I foud the sql is running long time is :
   
   ```
   select                                                                       
                                      
   
                                                                                
                                      
   
           id, name, task_type, process_instance_id, 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,
   
           first_submit_time, delay_time, task_params, var_pool, dry_run        
                                      
   
                                                                                
                                      
   
           from t_ds_task_instance                                              
                                      
   
           WHERE process_instance_id = $1                                       
                                      
   
           and flag = $2                                                        
                                      
   
           order by start_time desc                                             
                                      
   
   
   ```
   
   then I try to add the index  , and try delete the related process definition 
or process instance , it Just finsh in few seconds !!!
   
   
   
   ## Verify this pull request
   then I try to add the index  , and try delete the related process definition 
or process instance , it Just finsh in few seconds !!!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to