ok Jerome, here is full of sadness story
Our customer wants to implement fully custom controllable SLA scheme, firstly it was based on requestor organization, ticket impact and creation time (night tickets have slighty longer SLA).
Operating this 3 constraints we have build pretty fine and easy to administrate schema, but day by day requirements was increased up to differ SLA on moon phase, CEO happines level and distance in meters between customer and assignee.
So currently I'm planning schema with possibility to define SLA based on any attribute-value and it looks like:
Category have SREL attribute to SLA_Pack,
SLA_Pack have amout of SLA rules, SLA rule's structure:
- sequence (int)
- service type (SREL to sdsc)
- workshift (SREL to workshifts)
- constaraints (BREL to custom constraints)
constraints table:
- param (string)
- value (string)
- parent (SREL to SLA Rule)
I think this is looks hard to understand but it real environemnt it looks really easy.

I can use regular Site-Defined condition instead of custom build Constraints, but building them takes a lot of time, also I have implemented Quick Build string, which is converting string like "attr=val, attr=val, attr=val" into constraints.
Algorithm looks like:
- checking category for SLA pack;
- fetching all SLA rules on their sequence;
- checking one by one until all of constraints will return true;
Going back to topic question, I'm afraid that fetching a lot of data in our prod env can cause performance lack, so I want to slighty decrease it by predifining matching data via searching over BREL.
Search query should return all SLA rules that matching ticket data or haven't defined param at all.
Example:We have 3 rules in 1 pack: [impact=2, org=A], [impact=3, org=A], [org=A].
Ticket have next params [impact=3, org=A].
Rule 2 match ticket but rule 3 also match it (without impact param).
Building correct query that perform seach with results described before is my goal.
Sorry if my English is unreadable
Best regards,
cdtj