Mehdi Kargar Department of Computer Science and Engineering 1.

Slides:



Advertisements
Similar presentations
 Definition of B+ tree  How to create B+ tree  How to search for record  How to delete and insert a data.
Advertisements

Concurrency Control Part 2 R&G - Chapter 17 The sequel was far better than the original! -- Nobody.
1 AVL Trees. 2 AVL Tree AVL trees are balanced. An AVL Tree is a binary search tree such that for every internal node v of T, the heights of the children.
S. Sudarshan Based partly on material from Fawzi Emad & Chau-Wen Tseng
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | InnoDB Spatial Index Jimmy Yang Copyright © 2014, Oracle and/or its affiliates.
B+-Trees (PART 1) What is a B+ tree? Why B+ trees? Searching a B+ tree
AA Trees another alternative to AVL trees. Balanced Binary Search Trees A Binary Search Tree (BST) of N nodes is balanced if height is in O(log N) A balanced.
2-dimensional indexing structure
Department of Computer Science University of Maryland, College Park
Midterm 2 Overview Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
6/14/2015 6:48 AM(2,4) Trees /14/2015 6:48 AM(2,4) Trees2 Outline and Reading Multi-way search tree (§3.3.1) Definition Search (2,4)
Advanced Tree Data Structures Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter Trees and B-Trees.
Chapter 6: Transform and Conquer Trees, Red-Black Trees The Design and Analysis of Algorithms.
Project Proposals Simonas Šaltenis Aalborg University Nykredit Center for Database Research Department of Computer Science, Aalborg University.
CPSC 231 B-Trees (D.H.)1 LEARNING OBJECTIVES Problems with simple indexing. Multilevel indexing: B-Tree. –B-Tree creation: insertion and deletion of nodes.
Spatial Information Systems (SIS) COMP Spatial access methods: Indexing.
Chapter 3: Data Storage and Access Methods
Computer Science Red-Black CS 330: Algorithms and Red-Black Trees Gene Itkis.
Spatio-Temporal Databases. Introduction Spatiotemporal Databases: manage spatial data whose geometry changes over time Geometry: position and/or extent.
Chapter 4: Transaction Management
© 2004 Goodrich, Tamassia (2,4) Trees
Chapter 4: Trees AVL Trees Lydia Sinapova, Simpson College Mark Allen Weiss: Data Structures and Algorithm Analysis in Java.
Insertion into a B+ Tree Null Tree Ptr Data Pointer * Tree Node Ptr After Adding 8 and then 5… 85 Insert 1 : causes overflow – add a new level * 5 * 158.
R-Trees 2-dimensional indexing structure. R-trees 2-dimensional version of the B-tree: B-tree of maximum degree 8; degree between 3 and 8 Internal nodes.
1 Section 9.2 Tree Applications. 2 Binary Search Trees Goal is implementation of an efficient searching algorithm Binary Search Tree: –binary tree in.
Binary Trees Chapter 6.
Lecture 06: Tree Structures Topics: Trees in general Binary Search Trees Application: Huffman Coding Other types of Trees.
B-Tree. B-Trees a specialized multi-way tree designed especially for use on disk In a B-tree each node may contain a large number of keys. The number.
Xpath Query Evaluation. Goal Evaluating an Xpath query against a given document – To find all matches We will also consider the use of types Complexity.
B-trees (Balanced Trees) A B-tree is a special kind of tree, similar to a binary tree. However, It is not a binary search tree. It is not a binary tree.
Tree.
Spatial Data Management Chapter 28. Types of Spatial Data Point Data –Points in a multidimensional space E.g., Raster data such as satellite imagery,
CSCE350 Algorithms and Data Structure Lecture 17 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
Chapter 13 B Advanced Implementations of Tables – Balanced BSTs.
Generalized Search Trees J.M Hellerstein, J.F. Naughton and A. Pfeffer, “Generalized Search Trees for Database Systems,” Proc. 21 st Int’l Conf. On VLDB,
Mehdi Mohammadi March Western Michigan University Department of Computer Science CS Advanced Data Structure.
Balanced Search Trees Fundamental Data Structures and Algorithms Margaret Reid-Miller 3 February 2005.
M- tree: an efficient access method for similarity search in metric spaces Reporter : Ximeng Liu Supervisor: Rongxing Lu School of EEE, NTU
Parallel dynamic batch loading in the M-tree Jakub Lokoč Department of Software Engineering Charles University in Prague, FMP.
R-Tree. 2 Spatial Database (Ia) Consider: Given a city map, ‘index’ all university buildings in an efficient structure for quick topological search.
2-3 Tree. Slide 2 Outline  Balanced Search Trees 2-3 Trees Trees.
Computer Science: A Structured Programming Approach Using C Trees Trees are used extensively in computer science to represent algebraic formulas;
Comp 335 File Structures B - Trees. Introduction Simple indexes provided a way to directly access a record in an entry sequenced file thereby decreasing.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Xiaoying Gao, Peter Andreae, VUW B Trees and B+ Trees COMP 261.
Lecture1 introductions and Tree Data Structures 11/12/20151.
Chapter 12 B+ Trees CS 157B Spring 2003 By: Miriam Sy.
Physical Index Structures Logically, the index is a sorted list. Physically, the sorted order is normally maintained by pointers in a table. Tree-structured.
© 2004 Goodrich, Tamassia Trees
1 Chapter 7 Objectives Upon completion you will be able to: Create and implement binary search trees Understand the operation of the binary search tree.
Spatial Indexing Techniques Introduction to Spatial Computing CSE 5ISC Some slides adapted from Spatial Databases: A Tour by Shashi Shekhar Prentice Hall.
R-Trees: A Dynamic Index Structure For Spatial Searching Antonin Guttman.
Rooted Tree a b d ef i j g h c k root parent node (self) child descendent leaf (no children) e, i, k, g, h are leaves internal node (not a leaf) sibling.
Constructive Solid Geometry Ray Tracing CSG Models
1 CSIS 7101: CSIS 7101: Spatial Data (Part 1) The R*-tree : An Efficient and Robust Access Method for Points and Rectangles Rollo Chan Chu Chung Man Mak.
BINARY TREES Objectives Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms Discuss a binary.
R* Tree By Rohan Sadale Akshay Kulkarni.  Motivation  Optimization criteria for R* Tree  High level Algorithm  Example  Performance Agenda.
Presenters: Amool Gupta Amit Sharma. MOTIVATION Basic problem that it addresses?(Why) Other techniques to solve same problem and how this one is step.
BSTs, AVL Trees and Heaps Ezgi Shenqi Bran. What to know about Trees? Height of a tree Length of the longest path from root to a leaf Height of an empty.
1 R-Trees Guttman. 2 Introduction Range queries in multiple dimensions: Computer Aided Design (CAD) Geo-data applications Support special data objects.
Mehdi Kargar Department of Computer Science and Engineering
AA Trees.
Generalized Search Trees
Multiway Search Trees Data may not fit into main memory
CS522 Advanced database Systems
Btrees Insertion.
Alyce Brady CS 470: Data Structures CS 510: Computer Algorithms
(2,4) Trees (2,4) Trees (2,4) Trees.
Building Java Programs
R-tree – Another Example (1/2)
Presentation transcript:

Mehdi Kargar Department of Computer Science and Engineering 1

 R-tree is useful for indexing and representing multidimensional objects.  An R-tree is a depth balanced tree with a dynamic index structure ◦ Leaf nodes point to actual keys ◦ The number of entries in a node is between m and N (1 < m ≤ N) ◦ Root might have between 1 and N entries. ◦ All leaf nodes are at the same level ◦ The key for each internal node is the minimum bounding rectangle of its child nodes ◦ keys at all levels might have overlap with each other 2

3

 During the search for a key, it might be necessary to descend multiple sub-trees  Insertion is more complex than search ◦ After inserting a new key, the new bounding rectangle should be propagated up to the tree. ◦ If a node overflows, it should be split. The split should also be propagated up to the tree.  During the Insertion, only one sub-tree is traversed at each level. We should not descend multiple sub-trees. 4

1. The Monitor Solution 2. The Readers-Writers Solution 3. Locking Nodes (RLink-Tree) 5

public class MonitorRTree { public synchronized void add(Rectangle rect) {. } public synchronized boolean search(Rectangle rect) {. } 6

import java.util.concurrent.locks.ReentrantReadWriteLock; public class ReadWriteLockRTree { private ReentrantReadWriteLock lock;.... public void add(Rectangle rect) { this.lock.writeLock().lock();. this.lock.writeLock().unlock(); } public boolean search(Rectangle rect) { this.lock.readLock().lock();. this.lock.readLock().unlock(); } 7

 Basic idea : ◦ Logical Serial Number (LSN) is used to capture unfinished splits. ◦ Right Links is used to follow the split nodes. 8

 RLink-Tree uses the lock coupling strategy for inserting new entries.  The normal implementation of lock coupling leads to deadlocks. x ZY Process 1 Finding the best node for inserting new entries Read-Lock the nodes in a top-down approach Process 2 After Inserting new entry, the split and new bounding rectangle should be propagated Write-Lock the nodes in a bottom-up approach Write-Lock 2 1 Read-Lock 1 2 9

 The previous situation is called phantom problem.  It can be solved by predicate locks.  What are predicate locks ??  You can find more about it here : ◦ K. Eswaren, J. Gray, R. Lorie and I. Traiger, On the Notions of Consistency and Predicate Locks in a Database System, Comm. ACM, November 1976, Vol. 19, No. 11, pp. 624–

 Here, the root node is kept write-lock for the insertion of new nodes. Thus, only one process can insert at any time and we do not have multiple insertions.  The LSN and right links are the same as the original RLink-Tree.  Search algorithm and the read-lock mechanism is also the same as RLink-Tree. 11

12 public synchronized void readLock() { while (this.state == WRITE) { try { this.wait(); } catch (InterruptedException e) {} } this.increment(); } public synchronized void readUnlock() { this.decrement(); this.notifyAll(); } public synchronized void writeLock() { while (this.readers != 0 || state == WRITE) { try { this.wait(); } catch (InterruptedException e) {} } this.state = WRITE; } public synchronized void writeUnlock() { this.state = READ; this.notifyAll(); }

13

14

15

 Having multiple insertion process without locking the root.  Finding better solution for phantom problem. ... 16

 Verifying the implementations using different applications and tools such as Java PathFinder 17

18