Temporal and Spatial Database
Temporal and Spatial Database
Spatial Database
Dr S SRIDEVI
Conventional DB Vs Temporal DB
• Conventional DBs:
• Evolve through transactions from one state to the next
• Changes are viewed as modifications to the state
• No information about the past
• Snapshot of the enterprise
• Temporal DBs:
• Maintain historical information
• Changes are viewed as additions to the information stored in the
database
• Incorporate notion of time in the system
• Efficient access to past states
05/13/2023 2
Temporal Database
A temporal database is a database with built-in support for handling
data involving time, being related to the slowly changing dimension
concept, for example a temporal data model and a temporal version
of Structured Query Language (SQL).
Temporal Database
contains
Valid time. The valid time denotes when facts are true with respect to
the real world.
Transaction time. The transaction time of a database fact is the time
when the fact is entered in the database.
05/13/2023 3
Types of Temporal Data
• Static Data: This temporal data have zero temporality. Inferences that can be
derived from this data are free from any temporality.
• Sequences: Sequences are ordered sequence of the events or transactions.
This type of temporal data has the temporal relationship such as before, after,
during, meet and overlap etc.
• Time Stamped: This temporal data has explicit time related information.
Relationship can be quantitative. The inference is made through this type of data
may be temporal or non temporal.
• Time Series: Time series data is the special case of the time stamped data. In
time series data, events have uniform distance on the time scale.
• Fully Temporal: Data of this category is fully time dependent. The inferences
are also strictly temporal.
05/13/2023 4
Temporal Database (contd..)
05/13/2023 5
Different Forms of Temporal Database
05/13/2023 7
Operators on Intervals
Temporal predicate operators:
i1 = [s1,e1]; i2 = [s2,e2]
i1 i2
– i1 BEFORE i2
(e1<s2) i1 i2
– i1 MEETS i2
i1
(s2 = e1)
– i1 EQUALS i2 i2
(s1 = s2 AND e1 = e2) i1
i2
– i1 OVERLAPS i2
(s2 < s1 < e2 OR s1 < s2 < e1)
05/13/2023 8
Sample Query
Retrieve the state of the record for Chung at 9:30AM, April 4, 2004:
Query: Retrieving a Lost Row with Oracle Flashback Query
05/13/2023 9
Time Series Databases
• A time series database (TSDB) is a software system that is optimized for handling time
series data, arrays of numbers indexed by time (a datetime or a datetime range). In some
fields these time series are called profiles, curves, or traces.
• Time series data is a sequence of data points collected at regular intervals over a period of
time. In short, it is any data that has a timestamp, including Internet of Things (IoT) device
data, stocks, commodity prices, tide measurements, solar flare tracking, and health
information.
05/13/2023 10
TIME SERIES DATABASE REQUIREMENTS
•Data location: If related data is not co-located on the same physical
storage, queries can be slow and even result in time-outs.
•Fast, easy range queries: Analyzing time series data requires the ability to
write range queries. With many databases, the sheer volume of time series
data may cause the index to outpace the available memory, degrade read
and write performance, and produce errors. A NoSQL database that co-
locates related time series data ensures that requests complete without
error
•High write performance: Many databases are not able to serve requests
predictably and quickly during peak loads. Unless the database prioritizes
cluster availability over strong consistency, the database may become less
responsive or even completely unresponsive.
•Data compaction: As time series data ages, the granularity of the data
often becomes less relevant to the purpose of useful analysis. To be able to
store and retrieve the data efficiently, organizations must have the ability to
roll up and compress the data according to the needs of the business.
05/13/2023 11
BENEFITS OF A TIME SERIES DATABASE
05/13/2023 12
Applications of Temporal Database and Time Series
Database
•Finance : portfolio management, accounting & banking, stock market analysis, audit analysis
05/13/2023 13
What is a SDBMS ? (Spatial DBMS)
• A SDBMS is a software module that
• can work with an underlying DBMS
• supports spatial data models, spatial abstract data types (ADTs) and a
query language from which these ADTs are callable
• supports spatial indexing, efficient algorithms for processing spatial
operations, and domain specific rules for query optimization
• Example: Oracle Spatial data cartridge, ESRI SDE
• can work with Oracle 8i DBMS
• Has spatial data types (e.g. polygon), operations (e.g. overlap) callable
from SQL3 query language
• Has spatial indices, e.g. R-trees
Modeling: What need to be presented?
• Single object
Points, Lines and Regions
Modeling: What need to be presented?
• Spatially related collections of objects
Partitions-----a set of regions
Networks-----points and lines
SDBMS Example
• Consider a spatial dataset with:
• County boundary (dashed white line)
• Census block - name, area, population,
boundary (dark line)
• Water bodies (dark polygons)
• Satellite Imagery (gray scale pixels)
Fig 1.2
Spatial Data Types and Post-relational Databases
• Post-relational DBMS
• Support user defined abstract data types
• Spatial data types (e.g. polygon) can be added
• Choice of post-relational DBMS
• Object oriented (OO) DBMS
• Object relational (OR) DBMS
• A spatial database is a collection of spatial data types, operators, indices,
processing strategies, etc. and can work with many post-relational DBMS as
well as programming languages like Java, Visual Basic etc.
How is a SDBMS different from a GIS ?
• GIS is a software to visualize and analyze spatial data using spatial
analysis functions such as
• Search Thematic search, search by region, (re-)classification
• Location analysis Buffer, corridor, overlay
• Terrain analysis Slope/aspect, catchment, drainage network
• Flow analysis Connectivity, shortest path
• Distribution Change detection, proximity, nearest neighbor
• Spatial analysis/Statistics Pattern, centrality, autocorrelation, indices of similarity, topology: hole
description
• Measurements Distance, perimeter, shape, adjacency, direction
• Standards
• SQL3 (a.k.a. SQL 1999) is a standard for query languages
• OGIS is a standard for spatial data types and operators
• Both standards enjoy wide support in industry
• More details in chapters 2 and 3
1.6.3 •Query Processing
Efficient algorithms to answer spatial queries
• Common Strategy - filter and refine
• Filter Step:Query Region overlaps with MBRs of B,C and D
• Refine Step: Query Region overlaps with B and C
Fig 1.8
Query Processing of Join Queries
•Example - Determining pairs of intersecting rectangles
• (a):Two sets R and S of rectangles, (b): A rectangle with 2 opposite corners
marked, (c ): Rectangles sorted by smallest X coordinate value
• Plane sweep filter identifies 5 pairs out of 12 for refinement step
• Details of plane sweep algorithm on page 15
Fig 1.9
Spatial Indexing: Search Data-Structures
•Choice for spatial indexing:
• B-tree is a hierarchical collection of ranges of linear keys, e.g. numbers
• B-tree index is used for efficient search of traditional data
• B-tree can be used with space filling curve on spatial data
• R-tree provides better search performance yet!
• R-tree is a hierarchical collection of rectangles
• More details in chapter 4