Performance issue with xpath and/or generalization

We are working on premise with Mendix 6.10.2   We have "FINET$Confidentiality" using "System$filedocument" as generalization Then we have "FINET$Document" using "FINET$Confidentiality" as generalization Then we have "Documents$document" using "FINET$Document" as generalization   Path is : Documents$document -> FINET$Document -> FINET$Confidentiality -> System$filedocument   We have some attributes in each, but specially some into FINET$Confidentiality to say if it is confidential or not One attribute is "isConfidential" and one other "isOwnerConfidential" And we are using them into Xpath constraint to allow or not users to access documents based on confidentiality criterias We put Xpath constraints into "Documents$document" for some roles like "[not(isConfidential) or (isConfidential and not(isOwnerConfidential)]   Result seems we get biggest query and resulting in some performance issue and timeout. Without those xpath, no big issue with performance   One other path is attachment we plugged also on the same generalization FINET$Document to be able to use also confidentiality attributes and set into it some xpath constraints Other path is : Email$attachment -> FINET$Document -> FINET$Confidentiality -> System$filedocument   Do you have any idea if we did something wrong with xpath or generalization or whatever ?   Thanks in advance for response
1 answers

As a general rule generalizations will always give you performance hits and should be avoided unless you have to. Generalizations four deep is imho a fault in your architecture that could have been solved in a different way.

And operations like not in combination with or and again not is also a guarantee for performance hits.

I would go back to the drawing board and think things through. Why do I need 4 level deep generalizations? Can it be solved with a entity over reference? Are the not operations necesarry? Can it be solve by booleans?