Spatial Join.

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Sorting Really Big Files Sorting Part 3. Using K Temporary Files Given  N records in file F  M records will fit into internal memory  Use K temp files,
Spatial Indexing SAMs. Spatial Indexing Point Access Methods can index only points. What about regions? Z-ordering and quadtrees Use the transformation.
Spatial Join Queries. Spatial Queries Given a collection of geometric objects (points, lines, polygons,...) organize them on disk, to answer point queries.
Linked Lists. 2 Merge Sorted Lists Write an algorithm that merges two sorted linked lists The function should return a pointer to a single combined list.
1 40T1 60T2 30T3 10T4 20T5 10T6 60T7 40T8 20T9 R S C C R JOIN S?
Line Segment Intersection. Balanced binary search tree Internal nodes: Rightmost leaf in its left subtree Status Structure T.
6.830 Lecture 9 10/1/2014 Join Algorithms. Database Internals Outline Front End Admission Control Connection Management (sql) Parser (parse tree) Rewriter.
M180: Data Structures & Algorithms in Java
CS 540 Database Management Systems
Introduction to Spatial Database System Presented by Xiaozhi Yu.
Processing Data in External Storage CS Data Structures Mehmet H Gunes Modified from authors’ slides.
Modern Information Retrieval
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Spatial Queries Nearest Neighbor and Join Queries.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Spatio-Temporal Databases. Outline Spatial Databases Temporal Databases Spatio-temporal Databases Multimedia Databases …..
1 40T1 60T2 30T3 10T4 20T5 10T6 60T7 40T8 20T9 R S C C R JOIN S?
Database Management 9. course. Execution of queries.
SEMILARITY JOIN COP6731 Advanced Database Systems.
The X-Tree An Index Structure for High Dimensional Data Stefan Berchtold, Daniel A Keim, Hans Peter Kriegel Institute of Computer Science Munich, Germany.
Project 2 Presentation & Demo Course: Distributed Systems By Pooja Singhal 11/22/
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Spatial Query Processing Spatial DBs do not have a set of operators that are considered to be basic elements in a query evaluation. Spatial DBs handle.
Chapter 12 Query Processing. Query Processing n Selection Operation n Sorting n Join Operation n Other Operations n Evaluation of Expressions 2.
CS4432: Database Systems II Query Processing- Part 3 1.
CS411 Database Systems Kazuhiro Minami 11: Query Execution.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
CS4432: Database Systems II Query Processing- Part 2.
Chapter 15 A External Methods. © 2004 Pearson Addison-Wesley. All rights reserved 15 A-2 A Look At External Storage External storage –Exists beyond the.
CSCI 5708: Query Processing II Pusheng Zhang University of Minnesota Feb 5, 2004.
Lecture 9COMPSCI.220.FS.T Lower Bound for Sorting Complexity Each algorithm that sorts by comparing only pairs of elements must use at least 
CS 440 Database Management Systems Lecture 5: Query Processing 1.
CS 540 Database Management Systems
Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 4.
1 Chapter 12: Indexing and Hashing Indexing Indexing Basic Concepts Basic Concepts Ordered Indices Ordered Indices B+-Tree Index Files B+-Tree Index Files.
Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 6.
© 2006 Pearson Addison-Wesley. All rights reserved15 A-1 Chapter 15 External Methods.
Strategies for Spatial Joins
Spatial Queries Nearest Neighbor and Join Queries.
Storage Access Paging Buffer Replacement Page Replacement
CS 540 Database Management Systems
CS 440 Database Management Systems
Spatial Indexing.
Datastructure.
Processing Data in External Storage
External Methods Chapter 15 (continued)
(2,4) Trees 11/15/2018 9:25 AM Sorting Lower Bound Sorting Lower Bound.
Physical Join Operators
Lecture#12: External Sorting (R&G, Ch13)
Yan Huang - CSCI5330 Database Implementation – Access Methods
Spatio-Temporal Databases
Joining Interval Data in Relational Databases
(2,4) Trees 12/4/2018 1:20 PM Sorting Lower Bound Sorting Lower Bound.
Performance Join Operator Select * from R, S where R.a = S.a;
Lecture 2- Query Processing (continued)
Spatial Indexing I R-trees
Database Management Systems (CS 564)
Linked List and Selection Sort
CPS216: Advanced Database Systems
Lecture 13: Query Execution
(2,4) Trees 2/28/2019 3:21 AM Sorting Lower Bound Sorting Lower Bound.
Lecture 23: Query Execution
Data-Intensive Computing Systems Query Execution (Sort and Join operators) Shivnath Babu.
File Processing : Multi-dimensional Index
Sorting We may build an index on the relation, and then use the index to read the relation in sorted order. May lead to one disk block access for each.
Database Administration
Yan Huang - CSCI5330 Database Implementation – Query Processing
Generic Set Algorithms
Index Structures Chapter 13 of GUW September 16, 2019
Presentation transcript:

Spatial Join

Outline Relational Join Difference between relational and spatial join Spatial Join using R-trees

Relational Join Basic Join Algorithm Input: Relations R and S Output: Joined relation T T=empty set FOR EACH record r in R FOR EACH record s in S IF r.a==s.a THEN append r||s to T Complexity: O(|R||S|) R S . : . :

More Efficient Join Hash-based join Sort-merge join No need to sort both relations first. Relations have hash indices. Use hash to find the corresponding records. Sort-merge join Sort both relations first. Scan through both relations only once.

Hash-based Join Input: Relations R and S Output: Joined relation T T=empty set FOR EACH record r in R FOR EACH record s in hash(S, r.a) IF r.a==s.a THEN append r||s to T Complexity: O(|R||bucket|) R S . : . :

Sort-merge Join Input: Sorted relations R and S Output: Joined relation T T=empty set. RP = pointer to the first record in R. SP = pointer to the first record in S. WHILE (RP is not null) { WHILE (*RP.a  *SP.a) { IF (*RP.a == *SP.a) THEN add *RP||*SP to T SP++ } RP++ R S … a 2 3 5 8 … a 1 2 4 5 6 T 2 5 Complexity: O(|R|+|S|)

Spatial Join Hash-based join Sort-merge join Spatial join using R-trees Seeded trees Sort-merge join Iterative spatial join

Spatial Join Using R-trees Input: nodes R, S in R-trees. r_tree_join (R, S: node) IF (R, S are leaf nodes) THEN RETURN all overlapping objects in R and S FOR EACH r in R.children DO FOR EACH s Î S.children DO IF intersect (r,s) THEN r_tree_join (r,s) ;

Example: Spatial Join Using R-trees

Seeded Trees One relation, say R, has an R-tree as an index, but another relation, say S, has no index. Create an R-tree for the relation S, using the structure of the R-tree for the relation R. Advantage: Minimize the number of overlapping MBRs for two trees.

Iterative Spatial Join Similar to sort-merge join Plane sweep method Sort MBRs of objects in both relations by their lower bounds in the chosen dimension. Initialize sweep structures of A and B For each MBR X in the sorted list: Update the sweep structure of the other relation. Find MBRs in the sweep structure of other relation which overlaps X. Good for limited main memory

Example:Iterative Spatial Join 1 5 B 2 4 C 3 6 A D