Dynamic Indexability and Lower Bounds for Dynamic One-Dimensional Range Query Indexes

Similar documents
Dynamic Indexability and the Optimality of B-trees and Hash Tables

On the Cell Probe Complexity of Dynamic Membership or

Hashing Based Dictionaries in Different Memory Models. Zhewei Wei

The Batched Predecessor Problem in External Memory

ICS 691: Advanced Data Structures Spring Lecture 8

Algorithms and Data Structures: Efficient and Cache-Oblivious

Lecture 19 Apr 25, 2007

Write-Optimization in B-Trees. Bradley C. Kuszmaul MIT & Tokutek

Report on Cache-Oblivious Priority Queue and Graph Algorithm Applications[1]

I/O-Algorithms Lars Arge Aarhus University

Lecture 8 13 March, 2012

Lecture 22 November 19, 2015

Lecture Notes: Range Searching with Linear Space

38 Cache-Oblivious Data Structures

Lecture Notes: External Interval Tree. 1 External Interval Tree The Static Version

Lecture 6: External Interval Tree (Part II) 3 Making the external interval tree dynamic. 3.1 Dynamizing an underflow structure

Hierarchical Memory. Modern machines have complicated memory hierarchy

arxiv: v1 [cs.cr] 19 Sep 2017

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

Optimality in External Memory Hashing

Cpt S 223 Course Overview. Cpt S 223, Fall 2007 Copyright: Washington State University

Algorithms in Systems Engineering IE172. Midterm Review. Dr. Ted Ralphs

Introduction to I/O Efficient Algorithms (External Memory Model)

Lecture 7 8 March, 2012

INSERTION SORT is O(n log n)

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

Cache-Oblivious Algorithms A Unified Approach to Hierarchical Memory Algorithms

Lecture April, 2010

: Fundamental Data Structures and Algorithms. June 06, 2011 SOLUTIONS

Background. Contiguous Memory Allocation

The Right Read Optimization is Actually Write Optimization. Leif Walsh

CSE373: Data Structures and Algorithms Lecture 4: Asymptotic Analysis. Aaron Bauer Winter 2014

CSE 146. Asymptotic Analysis Interview Question of the Day Homework 1 & Project 1 Work Session

Algorithm 23 works. Instead of a spanning tree, one can use routing.

Path Minima Queries in Dynamic Weighted Trees

Massive Data Algorithmics

Assume you are given a Simple Linked List (i.e. not a doubly linked list) containing an even number of elements. For example L = [A B C D E F].

External-Memory Search Trees with Fast Insertions. Jelani Nelson

Data structures. Organize your data to support various queries using little time and/or space

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators)

A Distribution-Sensitive Dictionary with Low Space Overhead

Buffer Heap Implementation & Evaluation. Hatem Nassrat. CSCI 6104 Instructor: N.Zeh Dalhousie University Computer Science

Binary Search to find item in sorted array

An Optimal Dynamic Interval Stabbing-Max Data Structure?

LH*Algorithm: Scalable Distributed Data Structure (SDDS) and its implementation on Switched Multicomputers

Optimal External Memory Interval Management

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

Outline for Today. How can we speed up operations that work on integer data? A simple data structure for ordered dictionaries.

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

Planar Point Location in Sublogarithmic Time

Optimal Parallel Randomized Renaming

Practice Midterm Exam Solutions

Lecture 5. Treaps Find, insert, delete, split, and join in treaps Randomized search trees Randomized search tree time costs

CSC263 Week 12. Larry Zhang

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Algorithms and Game Theory Date: 12/3/15

Memory Management. Memory Management

Advanced Database Systems

Lecture Summary CSC 263H. August 5, 2016

Outline for Today. How can we speed up operations that work on integer data? A simple data structure for ordered dictionaries.

Week 10. Sorting. 1 Binary heaps. 2 Heapification. 3 Building a heap 4 HEAP-SORT. 5 Priority queues 6 QUICK-SORT. 7 Analysing QUICK-SORT.

Module 5: Hashing. CS Data Structures and Data Management. Reza Dorrigiv, Daniel Roche. School of Computer Science, University of Waterloo

CSE 373 OCTOBER 23 RD MEMORY AND HARDWARE

A tale of two trees Exploring write optimized index structures. Ryan Johnson

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48

Throughout this course, we use the terms vertex and node interchangeably.

Jana Kosecka. Linear Time Sorting, Median, Order Statistics. Many slides here are based on E. Demaine, D. Luebke slides

15-451/651: Design & Analysis of Algorithms November 4, 2015 Lecture #18 last changed: November 22, 2015

CSE 332 Spring 2014: Midterm Exam (closed book, closed notes, no calculators)

Today s Outline. CSE 326: Data Structures Asymptotic Analysis. Analyzing Algorithms. Analyzing Algorithms: Why Bother? Hannah Takes a Break

Lecture 9 March 4, 2010

Massive Data Algorithmics. Lecture 12: Cache-Oblivious Model

15 150: Principles of Functional Programming Sorting Integer Lists

ECE250: Algorithms and Data Structures Midterm Review

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

arxiv: v2 [cs.ds] 9 Apr 2009

Cuckoo Hashing for Undergraduates

Databases & External Memory Indexes, Write Optimization, and Crypto-searches

( ) n 5. Test 1 - Closed Book

Constant Price of Anarchy in Network Creation Games via Public Service Advertising

Exercises: Disjoint Sets/ Union-find [updated Feb. 3]

Exact Algorithms Lecture 7: FPT Hardness and the ETH

CS 137 Part 7. Big-Oh Notation, Linear Searching and Basic Sorting Algorithms. November 10th, 2017

Algorithm Design and Analysis

CPSC 311: Analysis of Algorithms (Honors) Exam 1 October 11, 2002

CSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators)

On Dynamic Range Reporting in One Dimension

Data Structures. Sorting. Haim Kaplan & Uri Zwick December 2013

Integer Algorithms and Data Structures

Clustering. (Part 2)

Chapter 8 DOMINATING SETS

Introduction. hashing performs basic operations, such as insertion, better than other ADTs we ve seen so far

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17

CSE 3101: Introduction to the Design and Analysis of Algorithms. Office hours: Wed 4-6 pm (CSEB 3043), or by appointment.

Test 1 Review Questions with Solutions

Funnel Heap - A Cache Oblivious Priority Queue

CSE373: Data Structures & Algorithms Lecture 9: Priority Queues. Aaron Bauer Winter 2014

Chapter 8 DOMINATING SETS

Next. 1. Covered basics of a simple design technique (Divideand-conquer) 2. Next, more sorting algorithms.

Transcription:

Dynamic Indexability and Lower Bounds for Dynamic One-Dimensional Range Query Indexes Ke Yi HKUST 1-1

First Annual SIGMOD Programming Contest (to be held at SIGMOD 2009) Student teams from degree granting institutions are invited to compete in a programming contest to develop an indexing system for main memory data. The index must be capable of supporting range queries and exact match queries as well as updates, inserts, and deletes. The choice of data structures (e.g., B-tree, AVL-tree, etc.)... is up to you. 2-1

First Annual SIGMOD Programming Contest (to be held at SIGMOD 2009) Student teams from degree granting institutions are invited to compete in a programming contest to develop an indexing system for main memory data. The index must be capable of supporting range queries and exact match queries as well as updates, inserts, and deletes. The choice of data structures (e.g., B-tree, AVL-tree, etc.)... is up to you. We think these problems are so basic that every DB grad student should know, but do we really have the answer? 2-2

Answer: Hash Table and B-tree! Indeed, (external) hash tables and B-trees are both fundamental index structures that are used in all database systems 3-1

Answer: Hash Table and B-tree! Indeed, (external) hash tables and B-trees are both fundamental index structures that are used in all database systems Even for main memory data, we should still use external versions that optimize cache misses 3-2

Answer: Hash Table and B-tree! Indeed, (external) hash tables and B-trees are both fundamental index structures that are used in all database systems Even for main memory data, we should still use external versions that optimize cache misses External memory model (I/O model): Memory Memory of size m Each I/O reads/writes a block Disk Disk partitioned into blocks of size b 3-3

4-1 The B-tree

The B-tree A range query in O(log b n + k/b) I/Os k: output size 4-2

The B-tree memory A range query in O(log b n + k/b) I/Os k: output size log b n log b m = log b n m 4-3

The B-tree memory A range query in O(log b n + k/b) I/Os k: output size log b n log b m = log b n m The height of B-tree never goes beyond 5 (e.g., if b = 100, then a B-tree with 5 levels stores n = 10 billion records). We will n assume log b m = O(1). 4-4

Now Let s Go Dynamic Focus on insertions first: Both the B-tree and hash table do a search first, then insert into the appropriate block B-tree: Split blocks when necessary Hashing: Rebuild the hash table when too full; extensible hashing [Fagin, Nievergelt, Pippenger, Strong, 79]; linear hashing [Litwin, 80] 5-1

Now Let s Go Dynamic Focus on insertions first: Both the B-tree and hash table do a search first, then insert into the appropriate block B-tree: Split blocks when necessary Hashing: Rebuild the hash table when too full; extensible hashing [Fagin, Nievergelt, Pippenger, Strong, 79]; linear hashing [Litwin, 80] These resizing operations only add O(1/b) I/Os amortized per insertion; bottleneck is the first search + insert 5-2

Now Let s Go Dynamic Focus on insertions first: Both the B-tree and hash table do a search first, then insert into the appropriate block B-tree: Split blocks when necessary Hashing: Rebuild the hash table when too full; extensible hashing [Fagin, Nievergelt, Pippenger, Strong, 79]; linear hashing [Litwin, 80] These resizing operations only add O(1/b) I/Os amortized per insertion; bottleneck is the first search + insert Cannot hope for lower than 1 I/O per insertion only if the changes must be committed to disk right away (necessary?) 5-3

Now Let s Go Dynamic Focus on insertions first: Both the B-tree and hash table do a search first, then insert into the appropriate block B-tree: Split blocks when necessary Hashing: Rebuild the hash table when too full; extensible hashing [Fagin, Nievergelt, Pippenger, Strong, 79]; linear hashing [Litwin, 80] These resizing operations only add O(1/b) I/Os amortized per insertion; bottleneck is the first search + insert Cannot hope for lower than 1 I/O per insertion only if the changes must be committed to disk right away (necessary?) Otherwise we probably can lower the amortized insertion cost by buffering, like numerous problems in external memory, e.g. stack, priority queue,... All of them support an insertion in O(1/b) I/Os the best possible 5-4

Dynamic B-trees for Fast Insertions LSM-tree [O Neil, Cheng, Gawlick, O Neil, 96]: Logarithmic method + B-tree m lm memory l 2 m 6-1

Dynamic B-trees for Fast Insertions LSM-tree [O Neil, Cheng, Gawlick, O Neil, 96]: Logarithmic method + B-tree m lm memory Insertion: O( l b log l n m ) l 2 m Query: O(log l n m + k b ) 6-2

Dynamic B-trees for Fast Insertions LSM-tree [O Neil, Cheng, Gawlick, O Neil, 96]: Logarithmic method + B-tree m lm memory Insertion: O( l b log l n m ) l 2 m Query: O(log l n m + k b ) Stepped merge tree [Jagadish, Narayan, Seshadri, Sudarshan, Kannegantil, 97]: variant of LSM-tree Insertion: O( 1 b log l n m ) Query: O(l log l n m + k b ) 6-3

Dynamic B-trees for Fast Insertions LSM-tree [O Neil, Cheng, Gawlick, O Neil, 96]: Logarithmic method + B-tree m lm memory Insertion: O( l b log l n m ) l 2 m Query: O(log l n m + k b ) Stepped merge tree [Jagadish, Narayan, Seshadri, Sudarshan, Kannegantil, 97]: variant of LSM-tree Insertion: O( 1 b log l n m ) Query: O(l log l n m + k b ) Usually l is set to be a constant, then they both have O( 1 b log n m ) insertion and O(log n m + k b ) query 6-4

More Dynamic B-trees Buffer tree [Arge, 95] Yet another B-tree (Y-tree) [Jermaine, Datta, Omiecinski, 99] 7-1

More Dynamic B-trees Buffer tree [Arge, 95] Yet another B-tree (Y-tree) [Jermaine, Datta, Omiecinski, 99] Insertion: O( 1 log n ), pretty fast since b log n typically, but b m m not that fast; if O( 1 ) insertion required, query becomes b O(bɛ + k ) b Query: O(log n m + k b ), much worse than the static B-tree s O(1+ k b ); if O(1 + k b ) query required, insertion cost becomes O( bɛ b ) 7-2

More Dynamic B-trees Buffer tree [Arge, 95] Yet another B-tree (Y-tree) [Jermaine, Datta, Omiecinski, 99] Insertion: O( 1 log n ), pretty fast since b log n typically, but b m m not that fast; if O( 1 ) insertion required, query becomes b O(bɛ + k ) b Query: O(log n m + k b ), much worse than the static B-tree s O(1+ k b ); if O(1 + k b ) query required, insertion cost becomes O( bɛ b ) Deletions? Standard trick: inserting delete signals 7-3

More Dynamic B-trees Buffer tree [Arge, 95] Yet another B-tree (Y-tree) [Jermaine, Datta, Omiecinski, 99] Insertion: O( 1 log n ), pretty fast since b log n typically, but b m m not that fast; if O( 1 ) insertion required, query becomes b O(bɛ + k ) b Query: O(log n m + k b ), much worse than the static B-tree s O(1+ k b ); if O(1 + k b ) query required, insertion cost becomes O( bɛ b ) Deletions? Standard trick: inserting delete signals No further development in the last 10 years. So, seems we can t do better, can we? 7-4

Main Result For any dynamic range query index with a query cost of q+o(k/b) and an amortized insertion cost of u/b, the following tradeoff holds { q log(u/q) = Ω(log b), for q < α ln b, α is any constant; u log q = Ω(log b), for all q. 8-1

Main Result For any dynamic range query index with a query cost of q+o(k/b) and an amortized insertion cost of u/b, the following tradeoff holds { q log(u/q) = Ω(log b), for q < α ln b, α is any constant; u log q = Ω(log b), for all q. Current upper bounds: q u log n m log n m 1 ( n m )ɛ ( n m )ɛ 1 8-2

Main Result For any dynamic range query index with a query cost of q+o(k/b) and an amortized insertion cost of u/b, the following tradeoff holds { q log(u/q) = Ω(log b), for q < α ln b, α is any constant; u log q = Ω(log b), for all q. Current upper bounds: q u Assuming log b n m log n m log n m 1 ( n m )ɛ ( n m )ɛ 1 = O(1), all the bounds are tight! 8-3

Main Result For any dynamic range query index with a query cost of q+o(k/b) and an amortized insertion cost of u/b, the following tradeoff holds { q log(u/q) = Ω(log b), for q < α ln b, α is any constant; u log q = Ω(log b), for all q. Current upper bounds: q u Assuming log b n m log n m log n m 1 ( n m )ɛ ( n m )ɛ 1 = O(1), all the bounds are tight! The technique of [Brodal, Fagerberg, 03] for the predecessor problem can be used to derive a tradeoff of q log(u log 2 n m ) = Ω(log n m ). 8-4

Lower Bound Model: Dynamic Indexability Indexability: [Hellerstein, Koutsoupias, Papadimitriou, 97] 9-1

Lower Bound Model: Dynamic Indexability Indexability: [Hellerstein, Koutsoupias, Papadimitriou, 97] 4 7 9 1 2 4 3 5 8 2 6 7 1 8 9 4 5 Objects are stored in disk blocks of size up to b, possibly with redundancy. Redundancy r = (total # blocks)/ n/b 9-2

Lower Bound Model: Dynamic Indexability Indexability: [Hellerstein, Koutsoupias, Papadimitriou, 97] a query reports {2,3,4,5} 4 7 9 1 2 4 3 5 8 2 6 7 1 8 9 4 5 Objects are stored in disk blocks of size up to b, possibly with redundancy. Redundancy r = (total # blocks)/ n/b 9-3

Lower Bound Model: Dynamic Indexability Indexability: [Hellerstein, Koutsoupias, Papadimitriou, 97] a query reports {2,3,4,5} cost = 2 4 7 9 1 2 4 3 5 8 2 6 7 1 8 9 4 5 Objects are stored in disk blocks of size up to b, possibly with redundancy. Redundancy r = (total # blocks)/ n/b The query cost is the minimum number of blocks that can cover all the required results (search time ignored!). Access overhead A = (worst-case) query cost / k/b 9-4

Lower Bound Model: Dynamic Indexability Indexability: [Hellerstein, Koutsoupias, Papadimitriou, 97] a query reports {2,3,4,5} cost = 2 4 7 9 1 2 4 3 5 8 2 6 7 1 8 9 4 5 Objects are stored in disk blocks of size up to b, possibly with redundancy. Redundancy r = (total # blocks)/ n/b The query cost is the minimum number of blocks that can cover all the required results (search time ignored!). Access overhead A = (worst-case) query cost / k/b Similar in spirit to popular lower bound models: model, semigroup model cell probe 9-5

Previous Results on Indexability Nearly all external indexing lower bounds are under this model 10-1

Previous Results on Indexability Nearly all external indexing lower bounds are under this model 2D range queries: r = Ω( log(n/b) log A ) [Hellerstein, Koutsoupias, Papadimitriou, 97], [Koutsoupias, Taylor, 98], [Arge, Samoladas, Vitter, 99] 10-2

Previous Results on Indexability Nearly all external indexing lower bounds are under this model 2D range queries: r = Ω( log(n/b) log A ) [Hellerstein, Koutsoupias, Papadimitriou, 97], [Koutsoupias, Taylor, 98], [Arge, Samoladas, Vitter, 99] 2D stabbing queries: A 0 A 2 1 = Ω( log(n/b) log r ) [Arge, Samoladas, Yi, 04] Refined access overhead: a query is covered by A 0 +A 1 k/b blocks 10-3

Previous Results on Indexability Nearly all external indexing lower bounds are under this model 2D range queries: r = Ω( log(n/b) log A ) [Hellerstein, Koutsoupias, Papadimitriou, 97], [Koutsoupias, Taylor, 98], [Arge, Samoladas, Vitter, 99] 2D stabbing queries: A 0 A 2 1 = Ω( log(n/b) log r ) [Arge, Samoladas, Yi, 04] Refined access overhead: a query is covered by A 0 +A 1 k/b blocks 1D range queries: A = O(1), r = O(1) trivially 10-4

Previous Results on Indexability Nearly all external indexing lower bounds are under this model 2D range queries: r = Ω( log(n/b) log A ) [Hellerstein, Koutsoupias, Papadimitriou, 97], [Koutsoupias, Taylor, 98], [Arge, Samoladas, Vitter, 99] 2D stabbing queries: A 0 A 2 1 = Ω( log(n/b) log r ) [Arge, Samoladas, Yi, 04] Refined access overhead: a query is covered by A 0 +A 1 k/b blocks 1D range queries: A = O(1), r = O(1) trivially Adding dynamization makes it much more interesting! 10-5

Dynamic Indexability Still consider only insertions 11-1

Dynamic Indexability Still consider only insertions time t: memory of size m 1 2 7 blocks of size b = 3 4 7 9 4 5 snapshot 11-2

Dynamic Indexability Still consider only insertions time t: memory of size m 1 2 7 blocks of size b = 3 4 7 9 4 5 snapshot time t + 1: 1 2 6 7 4 7 9 4 5 6 inserted 11-3

Dynamic Indexability Still consider only insertions time t: memory of size m 1 2 7 blocks of size b = 3 4 7 9 4 5 snapshot time t + 1: 1 2 6 7 4 7 9 4 5 6 inserted time t + 2: 4 7 9 1 2 5 6 8 8 inserted 11-4

Dynamic Indexability Still consider only insertions time t: memory of size m 1 2 7 blocks of size b = 3 4 7 9 4 5 snapshot time t + 1: 1 2 6 7 4 7 9 4 5 6 inserted time t + 2: 4 7 9 1 2 5 6 8 8 inserted transition cost = 2 11-5

Dynamic Indexability Still consider only insertions time t: memory of size m 1 2 7 blocks of size b = 3 4 7 9 4 5 snapshot time t + 1: 1 2 6 7 4 7 9 4 5 6 inserted time t + 2: 4 7 9 1 2 5 6 8 8 inserted transition cost = 2 Redundancy (access overhead) is the worst redundancy (access overhead) of all snapshots 11-6

Dynamic Indexability Still consider only insertions time t: memory of size m 1 2 7 blocks of size b = 3 4 7 9 4 5 snapshot time t + 1: 1 2 6 7 4 7 9 4 5 6 inserted time t + 2: 4 7 9 1 2 5 6 8 8 inserted transition cost = 2 Redundancy (access overhead) is the worst redundancy (access overhead) of all snapshots Update cost: u = the average transition cost per b insertions 11-7

Main Result Obtained in Dynamic Indexability Theorem: For any dynamic 1D range query index with access overhead A and update cost u, the following tradeoff holds, provided n 2mb 2 : { A log(u/a) = Ω(log b), for A < α ln b, α is any constant; u log A = Ω(log b), for all A. 12-1

Main Result Obtained in Dynamic Indexability Theorem: For any dynamic 1D range query index with access overhead A and update cost u, the following tradeoff holds, provided n 2mb 2 : { A log(u/a) = Ω(log b), for A < α ln b, α is any constant; u log A = Ω(log b), for all A. Because a query cost O(q + k/b ) implies O(q k/b ) 12-2

Main Result Obtained in Dynamic Indexability Theorem: For any dynamic 1D range query index with access overhead A and update cost u, the following tradeoff holds, provided n 2mb 2 : { A log(u/a) = Ω(log b), for A < α ln b, α is any constant; u log A = Ω(log b), for all A. Because a query cost O(q + k/b ) implies O(q k/b ) The lower bound doesn t depend on the redundancy r! 12-3

The Ball-Shuffling Problem b balls A bins 13-1

The Ball-Shuffling Problem b balls A bins cost = 1 13-2

The Ball-Shuffling Problem b balls A bins cost = 1 cost = 2 cost of putting the ball directly into a bin = # balls in the bin + 1 13-3

The Ball-Shuffling Problem b balls A bins 14-1

The Ball-Shuffling Problem b balls A bins Shuffle: cost = 5 14-2

The Ball-Shuffling Problem b balls A bins Shuffle: cost = 5 Cost of shuffling = # balls in the involved bins 14-3

The Ball-Shuffling Problem b balls A bins Shuffle: cost = 5 Cost of shuffling = # balls in the involved bins Putting a ball directly into a bin is a special shuffle 14-4

The Ball-Shuffling Problem b balls A bins Shuffle: cost = 5 Cost of shuffling = # balls in the involved bins Putting a ball directly into a bin is a special shuffle Goal: Accommodating all b balls using A bins with minimum cost 14-5

Ball-Shuffling Lower Bounds Theorem: The cost of any solution for the ball-shuffling problem is at least { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. cost lower bound A 15-1

Ball-Shuffling Lower Bounds Theorem: The cost of any solution for the ball-shuffling problem is at least { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. cost lower bound b 2 1 A 15-2

Ball-Shuffling Lower Bounds Theorem: The cost of any solution for the ball-shuffling problem is at least { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. cost lower bound b 2 b 4/3 1 2 A 15-3

Ball-Shuffling Lower Bounds Theorem: The cost of any solution for the ball-shuffling problem is at least { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. cost lower bound b 2 b 4/3 b log b 1 2 log b A 15-4

Ball-Shuffling Lower Bounds Theorem: The cost of any solution for the ball-shuffling problem is at least { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. cost lower bound b 2 b 4/3 b log b b 1 2 log b b ɛ A 15-5

Ball-Shuffling Lower Bounds Theorem: The cost of any solution for the ball-shuffling problem is at least { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. cost lower bound b 2 Tight (ignoring constants in big-omega) for A = O(log b) and A = Ω(log 1+ɛ b) b 4/3 b log b b 1 2 log b b ɛ A 15-6

The Workload Construction round 1: keys time 16-1

The Workload Construction round 1: keys round 2: time 16-2

The Workload Construction round 1: keys round 2: round 3: round b: time 16-3

The Workload Construction round 1: keys round 2: round 3: round b: time Queries that we require the index to cover with A blocks # queries 2mb 16-4

The Workload Construction round 1: round 2: round 3: snapshot snapshot snapshot keys time round b: snapshot Queries that we require the index to cover with A blocks # queries 2mb Snapshots of the dynamic index considered 16-5

The Workload Construction round 1: round 2: round 3: round b: keys There exists a query such that The b objects of the query reside in A blocks in all snapshots time All of its objects are on disk in all b snapshots (we have mb queries) The index moves its objects ub times in total 17-1

The Reduction An index with update cost u and access overhead A gives us a solution to the ball-shuffling game with cost ub for b balls and A bins 18-1

The Reduction An index with update cost u and access overhead A gives us a solution to the ball-shuffling game with cost ub for b balls and A bins Lower bound on the ball-shuffling problem: Theorem: The cost of any solution for the ball-shuffling problem is at least { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. 18-2

The Reduction An index with update cost u and access overhead A gives us a solution to the ball-shuffling game with cost ub for b balls and A bins Lower bound on the ball-shuffling problem: Theorem: The cost of any solution for the ball-shuffling problem is at least { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. { A log(u/a) = Ω(log b), for A < α ln b, α is any constant; u log A = Ω(log b), for all A. 18-3

Ball-Shuffling Lower Bound Proof { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. 19-1

Ball-Shuffling Lower Bound Proof { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. Will show: Any algorithm that handles the balls with an average cost of u using A bins cannot accommodate (2A) 2u balls or more. b < (2A) 2u, or u > is ub = Ω(b log A b). log b 2 log(2a), so the total cost of the algorithm 19-2

Ball-Shuffling Lower Bound Proof { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. Will show: Any algorithm that handles the balls with an average cost of u using A bins cannot accommodate (2A) 2u balls or more. b < (2A) 2u, or u > is ub = Ω(b log A b). log b 2 log(2a), so the total cost of the algorithm Prove by induction on u u = 1: Can handle at most A balls. 19-3

Ball-Shuffling Lower Bound Proof { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. Will show: Any algorithm that handles the balls with an average cost of u using A bins cannot accommodate (2A) 2u balls or more. b < (2A) 2u, or u > is ub = Ω(b log A b). log b 2 log(2a), so the total cost of the algorithm Prove by induction on u u = 1: Can handle at most A balls. u u + 1 2? 19-4

Ball-Shuffling Lower Bound Proof (2) Need tol show: Any algorithm that handles the balls with an average cost of u+ 1 2 using A bins cannot accommodate (2A)2u+1 balls or more. To handle (2A) 2u+1 balls, any algorithm has to pay an average cost of more than u + 1 2 per ball, or ( u + 1 ) (2A) 2u+1 = (2Au + A)(2A) 2u 2 in total. 20-1

Ball-Shuffling Lower Bound Proof (2) Need tol show: Any algorithm that handles the balls with an average cost of u+ 1 2 using A bins cannot accommodate (2A)2u+1 balls or more. To handle (2A) 2u+1 balls, any algorithm has to pay an average cost of more than u + 1 2 per ball, or ( u + 1 ) (2A) 2u+1 = (2Au + A)(2A) 2u 2 in total. Divide all balls into 2A batches of (2A) 2u each. 20-2

Ball-Shuffling Lower Bound Proof (2) Need tol show: Any algorithm that handles the balls with an average cost of u+ 1 2 using A bins cannot accommodate (2A)2u+1 balls or more. To handle (2A) 2u+1 balls, any algorithm has to pay an average cost of more than u + 1 2 per ball, or ( u + 1 ) (2A) 2u+1 = (2Au + A)(2A) 2u 2 in total. Divide all balls into 2A batches of (2A) 2u each. Accommodating each batch by itself costs u(2a) 2u 20-3

Ball-Shuffling Lower Bound Proof (3) Divide all balls into 2A batches of (2A) 2u each. Accommodating each batch by itself costs u(2a) 2u 21-1

Ball-Shuffling Lower Bound Proof (3) Divide all balls into 2A batches of (2A) 2u each. Accommodating each batch by itself costs u(2a) 2u The interference among the 2A batches costs > A(2A) 2u 21-2

Ball-Shuffling Lower Bound Proof (3) Divide all balls into 2A batches of (2A) 2u each. Accommodating each batch by itself costs u(2a) 2u The interference among the 2A batches costs > A(2A) 2u If a batch has at least one ball that is never shuffled in later batches, it is a bad batch, otherwise it is a good batch. 21-3

Ball-Shuffling Lower Bound Proof (3) Divide all balls into 2A batches of (2A) 2u each. Accommodating each batch by itself costs u(2a) 2u The interference among the 2A batches costs > A(2A) 2u If a batch has at least one ball that is never shuffled in later batches, it is a bad batch, otherwise it is a good batch. There are at most A bad batches 21-4

Ball-Shuffling Lower Bound Proof (3) Divide all balls into 2A batches of (2A) 2u each. Accommodating each batch by itself costs u(2a) 2u The interference among the 2A batches costs > A(2A) 2u If a batch has at least one ball that is never shuffled in later batches, it is a bad batch, otherwise it is a good batch. There are at most A bad batches There are at least A good batches 21-5

Ball-Shuffling Lower Bound Proof (3) Divide all balls into 2A batches of (2A) 2u each. Accommodating each batch by itself costs u(2a) 2u The interference among the 2A batches costs > A(2A) 2u If a batch has at least one ball that is never shuffled in later batches, it is a bad batch, otherwise it is a good batch. There are at most A bad batches There are at least A good batches Each good batch contributes at least (2A) 2u to the interference cost 21-6

Lower Bound Proof: The Real Work { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. 22-1

Lower Bound Proof: The Real Work { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. The merging lemma: There is an optimal ball-shuffling algorithm that only uses merging shuffles 22-2

Lower Bound Proof: The Real Work { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. The merging lemma: There is an optimal ball-shuffling algorithm that only uses merging shuffles Let f A (b) be the minimum cost to accommodate b balls with A bins 22-3

Lower Bound Proof: The Real Work { Ω(A b 1+Ω(1/A) ), for A < α ln b where α is any constant; Ω(b log A b), for any A. The merging lemma: There is an optimal ball-shuffling algorithm that only uses merging shuffles Let f A (b) be the minimum cost to accommodate b balls with A bins The recurrence f A+1 (b) min k,x 1 + +x k =b {f A(x 1 1) + + f A (x k 1) +kx 1 + (k 1)x 2 + + x k b} 22-4

Open Problems and Conjectures 1D range reporting log b). Im- Current lower bound: query Ω(log b), update Ω( 1 b prove to (log n m, 1 b log n m )? 23-1

Open Problems and Conjectures 1D range reporting log b). Im- Current lower bound: query Ω(log b), update Ω( 1 b prove to (log n m, 1 b log n m )? Closely related problems: range sum (partial sum), predecessor search 23-2

The Grant Conjecture Internal memory (RAM) External memory w: word size b: block size (in words) range sum O : (log n, log n) binary tree Ω : (log n, log n) [Pǎtraşcu, Demaine, 06] predecessor range reporting 24-1

The Grant Conjecture Internal memory (RAM) External memory w: word size b: block size (in words) range sum predecessor O : (log n, log n) binary tree Ω : (log n, log n) [Pǎtraşcu, Demaine, 06] O : query = update = min, { log log n log w log log w Ω :... [Beame, Fich, 02] log n log log n } range reporting 24-2

The Grant Conjecture Internal memory (RAM) External memory w: word size b: block size (in words) range sum predecessor range reporting O : (log n, log n) binary tree Ω : (log n, log n) [Pǎtraşcu, Demaine, 06] O : query = update = min, { log log n log w log log w Ω :... [Beame, Fich, 02] log n log log n O : (log log w, log w) O : (log log n, log n/ log log n) [Mortensen, Pagh, Pǎtraşcu, 05] Ω : open } 24-3

The Grant Conjecture Internal memory (RAM) External memory w: word size b: block size (in words) range sum predecessor range reporting O : (log n, log n) binary tree Ω : (log n, log n) [Pǎtraşcu, Demaine, 06] O : query = update = min, { log log n log w log log w Ω :... [Beame, Fich, 02] log n log log n O : (log log w, log w) O : (log log n, log n/ log log n) [Mortensen, Pagh, Pǎtraşcu, 05] Ω : open } O : (log l n m, l b log l n m ) B-tree + logarithmic method 24-4

The Grant Conjecture Internal memory (RAM) External memory w: word size b: block size (in words) range sum predecessor range reporting O : (log n, log n) binary tree Ω : (log n, log n) [Pǎtraşcu, Demaine, 06] O : query = update = min, { log log n log w log log w Ω :... [Beame, Fich, 02] log n log log n O : (log log w, log w) O : (log log n, log n/ log log n) [Mortensen, Pagh, Pǎtraşcu, 05] Ω : open } O : (log l n m, l b log l n m ) B-tree + logarithmic method Optimal for all three? 24-5

The Grant Conjecture Internal memory (RAM) External memory w: word size b: block size (in words) range sum predecessor range reporting O : (log n, log n) binary tree Ω : (log n, log n) [Pǎtraşcu, Demaine, 06] O : query = update = min, { log log n log w log log w Ω :... [Beame, Fich, 02] log n log log n O : (log log w, log w) O : (log log n, log n/ log log n) [Mortensen, Pagh, Pǎtraşcu, 05] Ω : open } O : (log l n m, l b log l n m ) B-tree + logarithmic method Optimal for all three? How large does b need to be for B-tree to be optimal? 24-6

The Grant Conjecture Internal memory (RAM) External memory w: word size b: block size (in words) range sum predecessor range reporting O : (log n, log n) binary tree Ω : (log n, log n) [Pǎtraşcu, Demaine, 06] O : query = update = min, { log log n log w log log w Ω :... [Beame, Fich, 02] log n log log n O : (log log w, log w) O : (log log n, log n/ log log n) [Mortensen, Pagh, Pǎtraşcu, 05] Ω : open } O : (log l n m, l b log l n m ) B-tree + logarithmic method Optimal for all three? How large does b need to be for B-tree to be optimal? We now know this is true for range reporting for b = ( n m )Ω(1) ; false for b = o(log log n) 24-7

The End T HAN K YOU Q and A 25-1