Some concept of Advanced Database System are Types Supported, Simple Data Model, Concurrency Control Two, Continuously Adaptive, Cost-Based Optimization, Data Access From Disks, Data Warehousing. Main points of this lecture are: Triggers and Active Databases, Idea of Triggers, Developed, Data Constraints, Players and Salary, Passive Database, Certain Situations, Event Condition Action Rule, Insert, Update
Download Triggers and Active Databases - Advanced Database System - Lecture Slides and more Slides Database Management Systems (DBMS) in PDF only on Docsity!
Triggers and Active Databases
What are Triggers, and why?
Idea of triggers were developed for “data constraints”
Example: Relation of baseball players and salary. If new player added, trigger will check to see if team is over salary cap and will impose a penalty to team.
Triggers make a passive database “active”
Database reacts to certain situations
Event Condition Action rule :
on event insert/update/delete,
if condition C is true
then do action A
Uses / Advantages
To move application logic and business rules into database
This allows more functionality for DBAs to establish vital constraints/rules of applications
Rules managed in some central “place”
Rules automatically enforced by DBMS, no matter which applications later come on line
Active DB vs Rule Systems
Expert Systems/AI:
Focus primarily on “reasoning” (in place of algorithmic solution), e.g.,
Typically, no “active action” can be taken
Typically no notion of “triggering” based on “events”, but rather chaining of facts together
Typically little data (all in main memory)
Typically, limited performance (RETE network)
Typically no notion of concurrent users and transactions
Theme : Generated
Triggers (active rules) are difficult to write correctly
Idea:
Trigger application specified at higher level (declarative)
Actual triggers to implement the application generated from specification - Semi-automatic - Correctness guaranteed
Example : Constraints
• Specify acceptable database states
• Mapping:
When
If
Then
Classification of Triggers
Two Types of Triggers
Generated: based on some higher-level specification
Handcrafted: usually specific to some application
Three Classes of Usage
Kernel DBMS: hard coded into kernel
DBMS services: enhances database functionality
External applications: creating triggers specific to application
Generated Triggers
DBMS Kernel
Referential integrity
If foreign key in a table is deleted or updated, it causes an action usually specified by user: set null/cascade
Materialized views
Set of triggers that keep data consistent
Either re-computes view, or
Better changes view each time base data is changed
Generated Triggers
External Applications
Workflow management
External tools with support for generation of “Process Rules/Models”
Handcrafted Triggers
Embedded DBMS Kernel
Metadata management
Internal audit trails
But:
Triggers excellent for prototyping; but often replaced by code directly