Performance issue below query is taking 15 sec to execute.Can i change this query it is creating problem.i try to found where this query is firing but i can't.


#1

select distinct RES.REV_, RES.ID_, RES.NAME_, RES.PARENT_TASK_ID_, RES.DESCRIPTION_, RES.PRIORITY_,
RES.CREATE_TIME_, RES.OWNER_, RES.ASSIGNEE_, RES.DELEGATION_, RES.EXECUTION_ID_,
RES.PROC_INST_ID_, RES.PROC_DEF_ID_, RES.CASE_EXECUTION_ID_, RES.CASE_INST_ID_,
RES.CASE_DEF_ID_, RES.TASK_DEF_KEY_, RES.DUE_DATE_, RES.FOLLOW_UP_DATE_, RES.SUSPENSION_STATE_, RES.TENANT_ID_ from ACT_RU_TASK RES
inner join ACT_RE_PROCDEF D on RES.PROC_DEF_ID_ = D.ID_ WHERE RES.NAME_ = ‘Confirmation’ and D.KEY_ = ‘admission’
and EXISTS (select ID_ from
ACT_RU_VARIABLE WHERE NAME_= ‘admissionYear’ and TASK_ID_ is null
and RES.PROC_INST_ID_ = PROC_INST_ID_ and
( ( TYPE_ is not null and TYPE_ = ‘double’
and DOUBLE_ is not null and DOUBLE_ >= 2085.0 ) or( TYPE_ is not null and TYPE_ = ‘short’
and LONG_ is not null and LONG_ >= 2085 ) or( TYPE_ is not null and TYPE_ = ‘integer’
and LONG_ is not null and LONG_ >= 2085 ) or( TYPE_ is not null and TYPE_ = ‘long’
and LONG_ is not null and LONG_ >= 2085 ) ) )
and EXISTS ( select ID_ from ACT_RU_VARIABLE WHERE NAME_= ‘branchId’
and TASK_ID_ is null and RES.PROC_INST_ID_ = PROC_INST_ID_
and ( ( TYPE_ is not null and TYPE_ = ‘double’
and DOUBLE_ is not null and DOUBLE_ = 1383.0 ) or( TYPE_ is not null and TYPE_ = ‘short’
and LONG_ is not null and LONG_ = 1383 ) or( TYPE_ is not null and TYPE_ = ‘integer’
and LONG_ is not null and LONG_ = 1383 ) or( TYPE_ is not null and TYPE_ = ‘long’
and LONG_ is not null and LONG_ = 1383 ) ) )
and EXISTS ( select ID_ from ACT_RU_VARIABLE WHERE NAME_= ‘studentNo’
and TASK_ID_ is null and RES.PROC_INST_ID_ = PROC_INST_ID_
and ( ( TYPE_ is not null and TYPE_ = ‘string’
and TEXT_ is not null and TEXT_ LIKE ‘%152%’ ) ) )
order by RES.CREATE_TIME_ desc LIMIT 5 OFFSET 0