Outline Temporal and Real-Time • Temporal database Databases: A survey • Real-time database Gultekin Ozsoyoglu and Richard T. Snodgrass 1995 Presented by Jian Xu Discussion by Lan Wu Temporal Database An example (from wiki) • Time as an important domain • a short biography of John Doe. – born on April 3rd, 1975 in Smallville. His birth was • Valid time and transaction time registered on April 4th, 1975. – Valid time models events in reality – He went to live on his own in Bigtown. Although he – Trans. time models facts known by database moved out on August 26th, 1994, he forgot to register the change of address officially. • Temporal data, Temporal database – He updated his record on December 27, 1994. – A database that supports some aspect of – John Doe was accidentally hit by a truck on April 1st, time. 2001. The coroner reported his date of death on the next day. Example (cont.) Example(cont.) • Recording valid time • Need for Transaction time Name Place VTStart VTEnd TTStart TTEnd Name Place Start-T End-T John Doe Smallville 03/04/1975 ∞ 04/04/1975 27/12/1994 John Doe Smallville 3-Apr-1975 ∞ 26-Aug-1993 John Doe Smallville 03/04/1975 26/08/1993 27/12/1994 ∞ John Doe Bigtown 26-Aug-1993 ∞ 1-Apr-2001 John Doe Bigtown 26/08/1993 ∞ 27/12/1994 ∞ John Doe Bigtown 26/08/1993 01/04/2001 27/12/1994 02/04/2001 1
Some approaches Some approaches • Temporal Relational • Temporal Object-Oriented – Data model – Data models • Extend relational model to support temporal data • Caruso, TIGUKAT, TOODM... – Query languages – Query languages • SQL based : TSQL2, HSQL, TDM... • SQL based : VISION, TOOSQL • RA based: Legol, TRA ... • Other variations : Quel, QBE based A close look at TSQL2 A close look at TSQL2 • Temporal query language TSQL2 • The above statement creates a valid-time state table – Record a media plan in a Temporal Database CREATE TABLE NBCShows • Insert temporal record into the table ( ShowName Char(30) NOT NULL, INSERT INTO NBCShows InsertionLength INTERVAL SECOND, VALUES (‘Roseanne’, INTERVAL ’30’, SECOND, 251000) VALID TIMESTAMP Cost Integer ‘Spring season 1994’ ; ) AS VALID STATE YEAR(2) TO NBCSeason; A close look at TSQL2 Temporal-Query processing • Query the database! • Focus on Temporal-Relational db. Example 2 How long has the Roseanne show • Query optimization run? – Highly desired • DB size grows monotonically SELECT SNAPSHOT ShowName, – More Involved CAST(VALID(N) TO INTERVAL DAY) • predicates involving time are harder to optimize FROM NBCShows(Showname) AS N • Inequalities are common – Opportunities exist WHERE N.ShowName = ‘Roseanne’ • Time is one-dimension, single direction 2
Temporal Operations (looks) Related Models • New joins • Temporal – As time is presented as intervals, joins over – Record time related tuples and query them temporal field involves interval comparison. • Time series – Implicit valid-time selection, only rows which – Identifying the nature of the phenomenon are valid at the same time are joined represented by the sequence of observations • Temporal Indexes – Forecasting – R-tree designed for objects that has spans • Stream over dimensionalities – Another sequential model – Interval-tree designed for intervals A note for stream system Have a break • A stream can be views as a queue of data arriving at a port of your computer • Stream elements can be time-stamped and treated as temporal data • A number of temporal queries also apply to stream data • Stream also have other distinctive characteristics and requirements Motivations The Real-time World • Real-time system • Real-time system is commonly used. – Rapid reaction to events – Aero-craft control system – Industry control, security alert ... – Various of Surveillance, Detection, and Tracking tasks • Real-time database • Data collected by RT-sys need also be – Operation need to be finished timely processed in real time – Validness of a results depends also on time – To support decision – To ensure timely reaction 3
New types of transactions Discussion • Hard , soft and firm transactions • Give examples for – Hard transaction – Hard : transaction should never miss deadline – Soft transaction – Soft : increasing penalty on miss of deadline – Firm transaction – Firm : 0-1 penalty and compare their common characters and differences. • Transaction type affects policy and strategy on transaction-processing Other factors Consistency • Factors characterize real-time trans. • Internal and external consistency – Transaction arrival pattern – Internal : data satisfies constraints – Data access type – External : data always reflect reality – Accessed-object properties – Knowledge of items to be used both with respect to transactions – CPU and I/O time knowledge • For real-time database, maintaining external consistency is of great importance New Trans. Management Ideas Discussion • Compare real-time transaction to • Compare transaction management in conventional trans, management. conventional database to what in real-time database and reason why transaction – Trans. cooperate v.s. compete cooperative is preferred. – Diff. in resolving data and resource conflicts • DBMS , maximize resource utilization • RT-DBMS, satisfy time constraints • Do you find other factors that may shape the transaction management differently in the two types of systems? 4
Trans. processing in RT-DB Trans. processing in RT-DB • Processing Hard-Deadline transaction • Processing Soft-Deadline/ Firm-Deadline – scheduling – database need to ENSURE the transaction • Earliest-deadline first can be finished on time • Highest-value first – Needs complete knowledge on above factors • least-slack time first – Utilize of real-time task scheduling • dynamic priority assignment – Concurrency control • lock-based protocols • Timestamp ordering protocols • Optimistic concurrency control protocols Conclusion • Both types of db are desired and has wide application • A lot of problems need to be investigated • Spatial-Temporal database • Stream system addresses some real-time applications. 5
Recommend
More recommend