Download presentation
Presentation is loading. Please wait.
Published byNora Rodgers Modified over 8 years ago
1
Elaborated By : REPUBLIQUE TUNISIENNE MINISTERE DE L’ENSEIGNEMENT SUPERIEUR University Year :2014-2015
2
Active Databases : Definition Conclusion Plan 2/26 Active Database Rules Introduction: preliminary aspects Exercice: Use of Triggers 1 5 Article presentation : Article presentation : A new approach to active rule scheduling 6 Advantages of Active Database 4 2 3 Conclusion Conclusion 7
3
Introduction : Preliminary aspects Introduction : Preliminary aspects
4
Définition Introduction Conventional DBMS are passive: they execute operations only upon explicit request. Traditional databases are passive: i.e. queries, updates, transactions executed only when requested. Disadvantage Passive DBMS Disadvantage Passive DBMS Applications Problem Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion Inventory control - reordering items when quantity in stock falls below threshold. Inventory control - reordering items when quantity in stock falls below threshold. Travel waiting List - book ticket as soon as right kind is available Travel waiting List - book ticket as soon as right kind is available Stock market -Buy/sell stocks when price below/above threshold Stock market -Buy/sell stocks when price below/above threshold
5
Introduction Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion Capabilities such as automatic monitoring of conditions & ability to take actions (e.g. re: timing) require an ACTIVE DBMS. there is the need of reactive capabilities: the DBMS autonomously reacts to some events and executes specified operations Capabilities such as automatic monitoring of conditions & ability to take actions (e.g. re: timing) require an ACTIVE DBMS. there is the need of reactive capabilities: the DBMS autonomously reacts to some events and executes specified operations
6
Definition AcTIVE Database Definition AcTIVE Database
7
Introduction Definition of Active Database An active database is a database in which some operations are automatically executed once a given situation arises The situation may correspond to the fact that: Some specified events arise, or Specific conditions or state transitions are detected We refer to active DBMS (ADBMS) to DBMS for which we can specify active rules, also called triggers An active rule (trigger) is a language construct for defining the system reactions Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion
8
Introduction Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion Queries and updates Active DBMS External Events Specification of the situations to be monitored (re) actions Applications (updates) Applications periodic polling Passive DBMS check reply Architectural approaches Active Database Passive Database
9
Introduction 9/26 Two initial approaches: 1 1 2 2 building special applications software that periodically polls the DB to determine relevant events (generally all coded in one application program. Frequency of poling is an issue though) specific code in applications programs to perform these tasks (problems – maintenance can be difficult conditions/actions might be spread over a few applications programs. Also, can be hard to understand such code fragments) Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion
10
Active Database Rules (Trigger)
11
IntroductionPrésentation The most well paradigm for trigger definition is the Event-Condition-Action (ECA) The most well paradigm for trigger definition is the Event-Condition-Action (ECA) If it arises, it activates the trigger. Event: if it is satisfied, the trigger action is executed. Condition: It is a sequence of operations that can also modify the database; such sequence is executed only if the condition is satisfied. Action: Specification of active rules : the ECA paradigm Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion
12
IntroductionPrésentation Specification of active rules : the ECA paradigm Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion What is an event? “An event is something which happens, which is of interest, and which can be mapped onto some time instant” What is an event? “An event is something which happens, which is of interest, and which can be mapped onto some time instant” Data modifications: insertions, deletions, modifications Data accesses: queries on tables DBMS operations: login of users, transaction management and authorization Application defined events (external event): room temperature too high Possibility of defining rules that can be activated before or after an event Possibility of combining events (composite events): Logical operators: and, or, etc. Sequence: a trigger is activated only if two or more events arise according to a specified order Temporal composition: a trigger is activated when event E2 arises 5 seconds after event E1
13
IntroductionPrésentation Specification of active rules : the ECA paradigm Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion What is a condition? “A condition is an additional check that is executed when the trigger is evaluated and before the action is executed What is a condition? “A condition is an additional check that is executed when the trigger is evaluated and before the action is executed WHERE clause of SQL; it is useful to have simple predicates because their evaluation is efficient the condition is true if and only if the query return the empty set (a possible meaning) call to a procedure call to a procedure Predicates Queries Application procedures
14
IntroductionPrésentation Specification of active rules : the ECA paradigm Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion What is an action? “An action is a sequence of operations that is executed when its trigger is considered and the trigger condition is true” What is an action? “An action is a sequence of operations that is executed when its trigger is considered and the trigger condition is true” If the trigger includes several events, in the action it is possible to execute different activities through the use of conditional predicates IF inserting IF deleting IF updating, IF updating(‘column_name’)
15
Introduction BEFORE – before the triggering event makes any changes to the database. You can alter the triggering event. Timing Options {BEFORE|AFTER|INSTEADOF } AFTER – executes after the triggering event is processed. Can't alter the triggering event INSTEAD OF – do something other than the triggering event. Map an insertion on a view to physical tables. Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion
16
IntroductionPrésentation Format for writing a trigger Create trigger name {before | after} {insert | delete | update [of list-of column-names]} on table-name [referencing references] [for each row] [when condition] PL/SQL block; Create trigger name {before | after} {insert | delete | update [of list-of column-names]} on table-name [referencing references] [for each row] [when condition] PL/SQL block; Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion CREATE TRIGGER Name {BEFORE | AFTER} Event ON Relation [REFERENCING { OLD [ROW] [AS] Variable |NEW [ROW] [AS] Variable | OLD TABLE [AS] Variable | NEW TABLE [AS] Variable}] [FOR EACH {ROW |STATEMENT}] [WHEN Condition ] CREATE TRIGGER Name {BEFORE | AFTER} Event ON Relation [REFERENCING { OLD [ROW] [AS] Variable |NEW [ROW] [AS] Variable | OLD TABLE [AS] Variable | NEW TABLE [AS] Variable}] [FOR EACH {ROW |STATEMENT}] [WHEN Condition ] Oracle: SQL99:
17
IntroductionPrésentation Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion Data model Primitive events Composite events Parameter passing Transition tables Net effectTerminationRule ordering Relational, object-relational Operations on the database No Yes No Yes (tuple, table) Yes (tuple) No Syntactic check Based on timeout Type + creation order Type + non deterministic choice Oracle SQL
18
Advantages Of Active Database Advantages Of Active Database
19
Introduction Présentation Advantages OfActiveDatabase B E C D A Simplify the applications program Facilitate the operations without user’s order. Maintain the security of the process. Testing Fiability Configuration of Taken decisons Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion
20
Use of triggers Exercice
21
Introduction Triggers: The Problem -Examples from COMPANY Database Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion 1. Limit all salary increases to 50%. 2. Enforce policy that salaries may never decrease. 3. All new hires for a given job code get the same starting salary, which is available in the STARTING_PAY table. EMPLOYEE(Name, SSN, Salary, DNO, SupervisorSSN, JobCode) DEPARTMENT(DNO, TotalSalary, ManagerSSN) STARTING_PAY(JobCode, StartPay)
22
Introduction Triggers: correction -Examples from COMPANY Database Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion EMPLOYEE(Name, SSN, Salary, DNO, SupervisorSSN, JobCode) create trigger emp_salary_limit before update of EMPLOYEE for each row where (new.Salary > 1.5 * old.Salary) set new.Salary = 1.5 * old.Salary; create trigger emp_salary_limit before update of EMPLOYEE for each row where (new.Salary > 1.5 * old.Salary) set new.Salary = 1.5 * old.Salary; “new” refers to the new tuple. “old” refers to the old tuple.
23
Introduction Triggers: correction -Examples from COMPANY Database Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion EMPLOYEE(Name, SSN, Salary, DNO, SupervisorSSN, JobCode) create trigger emp_salary_no_decrease before update of EMPLOYEE for each row where (new.Salary < old.Salary) begin log the event; signal error condition; end create trigger emp_salary_no_decrease before update of EMPLOYEE for each row where (new.Salary < old.Salary) begin log the event; signal error condition; end Method depends on DBMS.
24
Introduction Triggers: correction -Examples from COMPANY Database Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion EMPLOYEE(Name, SSN, Salary, DNO, SupervisorSSN, JobCode) STARTING_PAY(JobCode, StartPay) create trigger emp_start_pay before insert on EMPLOYEE for each row set Salary = (select StartPay fromSTARTING_PAY whereJobCode = new.JobCode) create trigger emp_start_pay before insert on EMPLOYEE for each row set Salary = (select StartPay fromSTARTING_PAY whereJobCode = new.JobCode)
26
Introduction Definition Of Active Database Active Database Rules Advantage Of Active Database Article Presentation Conclusion One of the main modules of an ADS is the rule scheduler, which has asignificant impact on the effectiveness and efficiency of ADSs. During the rule scheduling process, the rule scheduler is responsible for choosing one of the activated or ready-to-be-executed rules to evaluate its condition section or execute its action section, respectively. Average Response Time, Throughput, Response Time Standard Deviation are used to evaluate the effectiveness Time Overhead per Transaction, and CPU Utilization are used to evaluate the efficiency of rule scheduling approaches.
27
Introduction Definition Of Active Database Active Database Rules Advantage Of Active Database Article Presentation Conclusion Rules Processing Cycle.
28
Introduction Definition Of Active Database Active Database Rules Advantage Of Active Database Article Presentation Conclusion Results 28/26 The results of the experiments show thatE x -SJF EsTLA has a positive impact on the average response time,response time standard deviation,and through put of anADS and does not have any negative impact on its time over head per transaction and CPU utilization to improve the most effective unconstrained rule scheduling approach a new rule scheduling approach was developed which is equipped with a learning automaton One of the most challenges against introducing an effective rule scheduling process is the estimation of the act- ual execution times of active rules as accurate as possible
29
Introduction scheduling process two viewpoints (1) estimating the actual execution time of each active rule more precisely (2) decreasing the priority of the selection of the activated rules whose condition sections are false at the evaluation time. Definition Of Active Database Active Database Rules Advantage Of Active Database Article Presentation Conclusion
30
Introduction Definition Of Active Database Active Database Rules Advantage Of Active Database Article Presentation Conclusion The results of experiments revealed that the proposed approach improved the rule scheduling process according to the evaluation criteria.
31
Conclusion
32
Conclusion Introduction Maintain Security Active Rules Traditional Database Active Database needs Simple There are a number of research prototypes, & work in this area is ongoing. 32 Présentation Definition Of Active Database Active Database Rules Advantage Of Active Database Exercices Conclusion
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.