XPATH Causing the Performance Issue

0
There are 2 entities MS1CASE and CPL Present in the domain model having one to many association i.e; One MS1CASE object is associated with multiple CPL object. One physician object or one location object can be associated with multiple MS1CASE object. The data structure is like that for each user account one parent 'Account' object is there. Under that multiple APL objects we are creating. For each APL either one physician object or one location object or both combination of Physician & Location object is associated and top of that we are associating an access date window which is having from and to dates. So each APL object is associated with unique access date object also. Now by the access rule set up in domain model, We are restricting for each acccount whichever the MS1CASE data having same physician and location object associated which are present under that 'Acccount's APL details and the 'accessdate' attribute value of MS1CASE entity fits between the to and from dates of accessdate object of that acccount's APL Details. I am facing performance issues with the below XPATH and i did indexing as well, Please suggest a good way to improve the performance. [Deactivated = 'false' and MasterData.CPL_Case/MasterData.CPL[Deactivated = 'false' and OrdRefpathSurgType = 'rfp'] [     ( MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/Combo      and MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/Combo)     and     ( (MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/fromDate = empty        or MasterData.CPL_Case/MasterData.MS1Case/CreatedTime >= MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/fromDate) )     and     ( (MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/toDate = empty         or MasterData.CPL_Case/MasterData.MS1Case/CreatedTime <= MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/toDate)        and        (MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/fromDate = empty         or MasterData.CPL_Case/MasterData.MS1Case/CreatedTime >= MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/fromDate) )     and     ( (MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/toDate = empty        or MasterData.CPL_Case/MasterData.MS1Case/CreatedTime <= MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/toDate) )     or     ( MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/PhyOnly       and                    (MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/fromDate = empty       or MasterData.CPL_Case/MasterData.MS1Case/CreatedTime >= MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/fromDate)       and       (MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/toDate = empty        or MasterData.CPL_Case/MasterData.MS1Case/CreatedTime <= MasterData.CPL_Physician/MasterData.Physician/Portal.APL_Physician/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/toDate) )     or     ( MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/LocOnly       and        (MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/fromDate = empty        or MasterData.CPL_Case/MasterData.MS1Case/CreatedTime>= MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/fromDate)     and       (MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/toDate = empty        or MasterData.CPL_Case/MasterData.MS1Case/CreatedTime<= MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[Portal.APL_Account = '[%CurrentUser%]']/toDate) )    ]                        ]     
asked
3 answers
1

Hi Pavan,

I only looked at your XPATH and noticed there are a lot of ‘and’ & ‘or’ conditions used.

Its not good practice to do that. Certainly this will lead to performance issues.

Without understanding your domain model, requirement and the amount of data you are dealing with, a simple action I would suggest, which could bring some improvement is:

- Split your XPATH without conditions

- Have multiple retrieval’s for each condition

- Join them and return it

- Check if you have applied indexing

answered
0

Entities and Relations

 

answered
0

APL Relations

answered