awaichixigua opened a new issue, #17345:
URL: https://github.com/apache/dolphinscheduler/issues/17345

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   When the number of t_ds_process_instance  data entries exceeds 10000000  
,listproject api  very slow
   
   select
        p.id,
        p.name,
        p.code,
        p.description,
        p.user_id,
        p.flag,
        p.create_time,
        p.update_time ,
        u.user_name as user_name,
        (
        select
                COUNT(*)
        from
                t_ds_process_definition as def
        where
                def.project_code = p.code) as def_count,
        (
        select
                COUNT(*)
        from
                t_ds_process_definition_log def,
                t_ds_process_instance inst
        where
                def.code = inst.process_definition_code
                and def.version = inst.process_definition_version
                and def.project_code = p.code
                and inst.state = 1 ) as inst_running_count
   from
        t_ds_project p
   left join t_ds_user u on
        u.id = p.user_id
   where
        1 = 1
   group by
        p.id,
        u.user_name
   order by
        p.id desc;
   
   ### What you expected to happen
   
   Resolve slow SQL
   
   ### How to reproduce
   
   When the number of t_ds_process_instance  data entries exceeds 10000000  
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   3.1.x
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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