This Rulesheet used a condition statement that did a calculation and a difference, calling a statement when it evaluated as true, as shown:

As written, load.weight ->sum > plane.maxCargoWeight, the condition copies all the relevant cargo records into Corticon's memory to perform its sum, and then evaluates whether total weight is greater than the plane's capacity. Because you chose to extend to database, the number of values could be large. Corticon lets you optimize such calculations for non-conditional (column 0) actions.

You can recast the conditions by creating an attribute in the FlightPlan entity to store a calculation. Here, the load attribute was created, and then its properties were set so that the data type is Integer(the same as the weight data it will aggregate), and its mode is to Mode to Transient as this is data that will be just used locally:


You could rewrite the conditions and actions to create a non-conditional rule followed by a conditional test of the computed result, as follows:


This nonconditional rule optimizes the performance by calculating load on the database side, and then evaluating the load against maxCargoWeight in memory.

Note: This feature applies to all Collection operators that are aggregation operators: sum, avg, size, min, and max. See Aggregations that optimize EDC database access for more information about these Collection operators.