Claims
- 1. A method of forming an execution plan for at least one trigger in an active database, comprising:
determining any triggers that may be activated by an activating statement; determining any rows affected by the activating statement; forming an operator tree for the activating statement; forming a tree for the triggers that are activated by the activating statement, wherein the activated trigger is either a row-after trigger or a statement-after trigger; if the activated trigger is a row-after trigger, joining the tree for the row-after trigger to the operator tree for pipelined execution with the operator tree, wherein any rows affected by the activating statement are pipelined to the row-after trigger for input; and if the activated trigger is a statement-after trigger, joining the tree for the statement-after trigger to the operator tree for execution subsequent to the operator tree, the activated statement-after trigger obtaining input during execution from a temporary table that accumulates affected rows from the execution of the activating statement.
- 2. A method of forming an execution plan for triggers in an active database as recited in claim 1, wherein the step of joining the tree of row triggers to the operator tree of the activating statement for pipelined execution includes interconnecting a flow operator between the trigger tree and the tree of the activating statement.
- 3. A method of forming an execution plan for triggers in an active database as recited in claim 1, wherein the step of joining the action tree for the activated statement-after trigger to the operator tree of the activating statement for execution subsequent to activating statement includes:
interconnecting a flow operator between the temporary table and the activating statement tree; and interconnecting an ordered union operator between the flow operator and the tree for the activated statement-after trigger.
- 4. A method of forming an execution plan for triggers in an active database as recited in claim 1,
wherein there are a plurality of row-after triggers activated by the activating statement; wherein forming a tree for at least one trigger action that is activated by the activating statement includes forming trees for the plurality of activated row-after triggers; wherein the step of joining the row-after tree to the statement tree includes joining each tree of the plurality of trees for the plurality of activated row-after triggers to the tree of the activating statement for pipelined execution with the tree.
- 5. A method of forming an execution plan for triggers in an active database as recited in claim 4,
wherein the plurality of trees for the plurality of activated row-after triggers forms a parallel row group; and wherein the step of joining each tree to the statement tree for pipelined execution with the statement tree includes: connecting each tree to a parallel union operator; and interconnecting a flow operator between the parallel union operator and the operator tree.
- 6. A method of forming an execution plan for triggers in an active database as recited in claim 1,
wherein there are a plurality of statement-after triggers activated by the activating statement; wherein forming a tree for at least one trigger that is activated by the activating statement includes forming trees for the plurality of activated statement-after triggers; and wherein the step of joining the statement-after tree to the statement tree includes joining each tree of the plurality of trees for the plurality of activated statement-after triggers to the tree of the activating statement for execution subsequent to the tree.
- 7. A method of forming an execution plan for triggers in an active database as recited in claim 6,
wherein the plurality of trees for the plurality of activated statement-after triggers forms a parallel statement group; and wherein the step of joining each tree to the statement tree for execution subsequent to the statement tree includes: connecting each tree to a parallel union operator; and interconnecting a flow operator between the temporary table and the operator tree; and interconnecting an ordered union operator between the parallel union operator and the flow operator.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application is related to U.S. Application entitled “A METHOD OF EXECUTING CONFLICTING TRIGGERS IN AN ACTIVE DATABASE”, Ser. No. ______, filed on ______; and to U.S. Application entitled “A METHOD OF EXECUTING BEFORE-TRIGGERS IN AN ACTIVE DATABASE, Ser. No. ______,filed on ______