Constraint key query
At store-record time, in an operation known as a constraint key query, the Rules Engine may attempt to get primary key information of records being processed. This is because database values needed during later transaction checks will be retrieved faster if primary key values can be used.
Constraint key queries are identified in BenchMark profiler output as having Reason = CONSTRAINT_KEYQUERY.
A business rule: "A guide cannot guide more than one tour at the same time" is implemented by a restrictive constraint:
In this constraint, there is no join based on relationship columns (because there is no relationship). When a manipulation takes place on the SCHEDTOUR table, a constraint key query is issued to retrieve the primary key values of the driving table (SCHEDTOUR st1). These primary key values are substituted during the transaction check at commit time:
This check will now perform much faster than without the primary key information.