Distributed Query Processing
Distributed Query Processing
Agenda
Query Processing 101
centralized query processing distributed query processing
Middleware
SQL and XML data integration
Problem Statement
Input: Query
How many times has the moon circled around the earth in the last twenty years?
Output: Answer
240!
Objectives:
response time, throughput, first answers, little IO, ...
Step 3: Interpretation
Query result
Algebra
A.d
relational algebra for SQL very well understood algebra for OQL fairly well understood algebra for XQuery (work in progress)
Query Optimization
A.d A.a = B.b, A.c = 35 X A B index A.c A.d hashjoin B.b B
no brainers (e.g., push down cheap predicates) enumerate alternative plans, apply cost model use search heuristics to find cheapest plan
Query Execution
John A.d
library of operators (hash join, merge join, ...) pipelining (iterator model) lazy evaluation exploit indexes and clustering in database
Current problems
statistics, cost model for optimization physical database design expensive
Trends
interactiveness during execution approximate answers more and more functionality, powerful models (XML)
What is different?
extend physical algebra: send&receive operators resource vectors, network interconnect matrix caching and replication optimize for response time less predictability in cost model (adaptive algos) heterogeneity in data formats and data models
receive
send
receive
send
B.b
index A.c B
Cost
1 8
1
1
6
6
2
5 10
Response Time
25, 33 independent, pipelined parallelism 24, 32 Total Cost = 40 first tuple = 25 last tuple = 33
0, 7
0, 6
0, 24
0, 18
0, 12
0, 5 0, 10 first tuple = 0 last tuple = 10
Adaptive Algorithms
Deal with unpredictable events at run time
delays in arrival of data, burstiness of network autonomity of nodes, change in policies
Heterogeneity
Use Wrappers to hide heterogeneity Wrappers take care of data format, packaging Wrappers map from local to global schema Wrappers carry out caching
connections, cursors, data, ...
Wrappers map queries into local dialect Wrappers participate in query planning!!!
define the subset of queries that can be handled give cost information, statistics capability-based rewrite (HKWY, VLDB 1997)
Data Cleaning
Are two objects the same? Is D. A. Kossman the same as Kossmann? Is the object that was at Position x 10 min. ago the same as the object at Position y now? Approaches (combination of)
statistical domain knowledge human interspection
Very Expensive
Summary
Theory very well understood
extend traditional (centralized) query processing add some bells and whistles heterogeinity needs manual work and wrappers
Problems in Practice
cost model, statistics architectures are not fit for adaptivity, heterogeneity optimizers do not scale for 10,000s of sites autonomy of sites, systems not built for asynchronous communication data cleaning
Middleware
Two kinds of middleware
data warehouses virtual integration
Data Warehouses
good: query response times good: materializes results of data cleaning bad: high resource requirements in middleware bad: staleness of data
Virtual Integration
the opposite caching possible to improve response times
Virtual Integration
Query
Middleware (query decomposition, result composition) wrapper sub query wrapper sub query
DB1
DB2
SQL DB1
SQL DB2
Adding XML
Query XML Publishing Middleware (SQL) wrapper wrapper
sub query
DB1
sub query
DB2
DB1
DB2
Problems
XML - SQL mapping is very difficult XML is not always the right language (e.g., decision support style queries)
Summary
Middleware looks like a homogenous, centralized database
location transparency data model transparency
Various kinds of middleware (SQL, OQL, XML) Stacks of middleware possible Data Cleaning requires special attention