DB alerts on a particular query from the 'Change Requests' module
search cancel

DB alerts on a particular query from the 'Change Requests' module

book

Article ID: 382487

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

  • Alerts are being issued for the following query
  • It is resulting in high CPU usage at the DB server
  • The DB in use is MS SQL Server
  • Which module is this query being triggered from?

Query:

(
    @P0 decimal(?, ?),
    @P1 decimal(?, ?),
    @P2 decimal(?, ?)
)
SELECT
    s0.id odf_pk,
    (
        CASE
            WHEN s0.PK_ID = (
                SELECT
                    ID
                FROM
                    INV_INVESTMENTS INV
                WHERE
                    ODF_OBJECT_CODE = ?
                    AND ID = s0.PK_ID
            ) THEN s0.PK_ID
            ELSE NULL
        END
    ) as prprojectid
FROM
    rim_risks_and_issues s0 (NOLOCK)
WHERE
    (
        s0.id = @P0
        and (
            exists(
                select
                    ?
                from
                    (
                        select
                            sec.user_id
                        from
                            cmn_sec_chk_user_r_v0 sec
                        where
                            ? = ?
                            and sec.object_id = ?
                            and sec.permission_code = ?
                    ) odf_view_all
                where
                    odf_view_all.user_id = @P1
            )
            or s0.id in (
                select
                    sec.object_instance_id
                from
                    cmn_sec_chk_user_v0 sec
                where
                    ? = ?
                    and sec.object_id in (
                        select
                            id
                        from
                            CMN_SEC_OBJECTS
                        where
                            object_code = ?
                            and object_type_code = ?
                            and sec.permission_code = ?
                        UNION
                        select
                            id
                        from
                            CMN_SEC_OBJECTS
                        where
                            object_code = ?
                            and object_type_code = ?
                            and sec.permission_code = ?
                        UNION
                        select
                            sec_obj.id
                        from
                            cmn_sec_objects sec_obj,
                            odf_objects obj
                        where
                            sec_obj.object_code = concat(?, obj.code)
                            and obj.template_extension = ?
                            and sec_obj.component_code = ?
                            and sec_obj.object_type_code = ?
                            and sec.permission_code = ?
                    )
                    and sec.permission_code in (?, ?)
                    and sec.user_id = @P2
            )
        )
    )

Cause

Unknown

Resolution

  • This query is triggered from the 'Change Requests' module
  • It could be due to processes that work on this module as well.