I have a problem with my query data ,
it become very slower when i try to access at pag 1200
i also use case when in my query
Select Reg_ID,Reg_Service_ID,Reg_Patient_ID,Patient_Name,Doctor_ID,Doctor_Name,
CASE WHEN EncounterSatuSehatID <>'-' and ConditionID <>'-'
THEN 'Selesai'
ELSE
'Tidak Selesai'
END AS 'Use Case 1' ,
EncounterSatuSehatID,
ConditionID,
CASE WHEN CompositionID <>'-' and SatuSehatProcedureID <>'-' and ObservationID <>'-'
THEN 'Selesai'
ELSE
'Tidak Selesai'
END AS 'Use Case 2',
Status,
Poly_Name,
Reg_OpenDate
from (
Select A.Reg_ID,Reg_Service_ID,Patient_Name,Reg_Patient_ID,Doctor_ID,Doctor_Name,Reg_OpenDate,
CASE WHEN B.EncounterSatuSehatID IS NULL
THEN '-'
ELSE
B.EncounterSatuSehatID
END
EncounterSatuSehatID,
CASE WHEN C.ConditionID is null
THEN '-'
ELSE
C.ConditionID END ConditionID
, CASE WHEN D.CompositionID is null
THEN '-'
ELSE
D.CompositionID
END CompositionID ,CASE WHEN
E.SatuSehatProcedureID is null
THEN '-'
ELSE E.SatuSehatProcedureID END
SatuSehatProcedureID ,
CASE WHEN F.ID is null
THEN '-'
ELSE
F.ID
END ObservationID,
CASE WHEN Reg_Active = 1 and Reg_IsCancel =0
THEN 'Aktif'
WHEN ((Reg_Active =1 and Reg_IsCancel =1) OR (Reg_Active=0 and Reg_IsCancel=1))
THEN 'Batal'
ELSE
'Selesai'
END 'Status',
Poly_Name
from Table1 A
left join Table2 B on A.Reg_ID=B.Reg_ID
left join Table3 C on A.Reg_ID=C.REG_ID
left join Table4 D on A.Reg_ID=D.Reg_ID
left join Table5 E on A.Reg_ID=E.RegID
left join Table6 F on A.Reg_ID=F.RegID
)A
order by Reg_OpenDate desc
OFFSET (122614-1) * 5 ROWS
FETCH FIRST 5 ROWS ONLY
that was my query
So i want to access page 122614
and it is very slow
What I have tried:
Is anyone can help me solve this?