fuchanghai commented on PR #15452:
URL: 
https://github.com/apache/dolphinscheduler/pull/15452#issuecomment-1884237360

   BTW , your current aggregate statistics still check all projects. I suggest 
that the statistics code is best written separately. For example, the following 
SQL code only checks the aggregate statistics of the project on the current 
page.
   
   ```sql
       <select id="queryRunningProcessInstanceNumber" 
resultType="org.apache.dolphinscheduler.dao.model.ProjectInstanceRunningDTO">
           SELECT COUNT(*) as inst_running_count,def.project_code 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
           <if test="projectsCodes != null and projectsCodes.size() > 0">
               and def.project_code in
               <foreach item="code" index="index" collection="projectsCodes" 
open="(" separator="," close=")">
                   #{code}
               </foreach>
           </if>
           AND inst.state=1 group by def.project_code
       </select>
   
   ```


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