Set Oriented Manipulations |
Before USoft Developer 5.2, the Rules Engine would always handle manipulations record-by-record. This means that for each record to be manipulated, the Rules Engine checks the record against all restrictive and corrective rules, and after that manipulates the specific record. As of USoft Developer 5.2, the Rules Engine will only handle manipulations record-by-record if constraints or relationships need to be checked. If no restrictive or corrective rules have to be checked, the Rules Engine handles the manipulation in a set-oriented way and sends the manipulation directly to the database. By default, set-oriented manipulations will always be used (if possible) in batch applications, and are not allowed in online applications. In the Authorizer, the Allow Set Manipulations additional parameter specifies whether manipulations are handled set-oriented or not. This parameter can be specified separately for batch and online applications. The default value of this parameter is 'False' for online applications and 'True' for batch applications. Example This example demonstrates the difference between handling a statement record-by-record or as a set. Suppose there is an ORDER table and an ORDER_HISTORY table. Some constraint inserts a record in the history table every time the total amount of the order changes. A batch job, which runs once a month, removes all occurrences of closed orders in the history table.
The batch job contains a SQL statement: DELETE FROM order_history oh WHERE EXISTS (SELECT '' FROM order o WHERE o.id=oh.order_id AND oh.status = 'CLOSED' ) If manipulations are handled record-by-record, the Rules Engine:
If manipulations are handled set-oriented, the handling of this batch job statement has been optimized: all history records are now deleted in one single SQL statement: DELETE FROM ORDER_HISTORY WHERE EXISTS (SELECT '' FROM ORDER t1 WHERE ORDER_HISTORY.ID=t1.ID AND t1.STATUS = 'CLOSED') ) Related Topics |