Skip to content

[Improvement] Slow project list query issue #15448

@chen877511127

Description

@chen877511127

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

When t_ds_process_instance table data reaches 300000,Project management list query takes 10 seconds

What you expected to happen

    select
    <include refid="baseSqlV2">
        <property name="alias" value="p"/>
    </include>
    ,
    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

How to reproduce

When t_ds_process_instance table data reaches 300000

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions