Logical Aspects of Massively Parallel and Distributed Systems

Similar documents
Logical Aspects of Massively Parallel and Distributed Systems

Reasoning on data partitioning for single-round multi-join evaluation in massively parallel systems Link Peer-reviewed author version

Remaining CALM in Declarative Networking. Frank Neven Hasselt University

Lecture 1: Conjunctive Queries

Data partitioning for single-round multi-join evaluation in massively parallel systems

Lecture 9: Datalog with Negation

Declarative Networking: Recent Theoretical Work on Coordination, Correctness, and Declarative Semantics

CSE 544: Principles of Database Systems

Processing Regular Path Queries Using Views or What Do We Need for Integrating Semistructured Data?

Database Theory: Beyond FO

A Retrospective on Datalog 1.0

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems

Parallel Skyline Queries

Datalog. Susan B. Davidson. CIS 700: Advanced Topics in Databases MW 1:30-3 Towne 309

On the Hardness of Counting the Solutions of SPARQL Queries

Finding Equivalent Rewritings in the Presence of Arithmetic Comparisons

Using Statistics for Computing Joins with MapReduce

Advanced Query Processing

Optimization of logical query plans Eliminating redundant joins

Chapter 10 Part 1: Reduction

Graph Databases. Advanced Topics in Foundations of Databases, University of Edinburgh, 2017/18

Introduction to Finite Model Theory. Jan Van den Bussche Universiteit Hasselt

Massively Parallel Communication and Query Evaluation

XML Research for Formal Language Theorists

Data Integration: Logic Query Languages

Rewriting Ontology-Mediated Queries. Carsten Lutz University of Bremen

Structural characterizations of schema mapping languages

Topology - I. Michael Shulman WOMP 2004

Enhancing Datalog with Epistemic Operators to Reason About Systems Knowledge in

Uncertainty in Databases. Lecture 2: Essential Database Foundations

Join Algorithms. Qiu, Yuan and Zhang, Haoqian

Inverting Schema Mappings: Bridging the Gap between Theory and Practice

Foundations of Schema Mapping Management

arxiv: v1 [cs.db] 12 Dec 2015

Foundations of Databases

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and

Principles of AI Planning. Principles of AI Planning. 7.1 How to obtain a heuristic. 7.2 Relaxed planning tasks. 7.1 How to obtain a heuristic

Complexity Theory for Map-Reduce. Communication and Computation Costs Enumerating Triangles and Other Sample Graphs Theory of Mapping Schemas

Relational Design: Characteristics of Well-designed DB

Database Theory VU , SS Codd s Theorem. Reinhard Pichler

Eventual Consistency Today: Limitations, Extensions and Beyond

6.842 Randomness and Computation September 25-27, Lecture 6 & 7. Definition 1 Interactive Proof Systems (IPS) [Goldwasser, Micali, Rackoff]

Data integration lecture 2

8.1 Polynomial-Time Reductions

Annoucements. Where are we now? Today. A motivating example. Recursion! Lecture 21 Recursive Query Evaluation and Datalog Instructor: Sudeepa Roy

Schema Design for Uncertain Databases

Data integration lecture 3

Foundations of Databases

Approximation Algorithms

Final Exam Review 2. Kathleen Durant CS 3200 Northeastern University Lecture 23

DISCRETE MATHEMATICS

Deduction in the Presence of Distribution and Contradictions

Discrete Mathematics Lecture 4. Harper Langston New York University

Sublinear Algorithms January 12, Lecture 2. First, let us look at a couple of simple testers that do not work well.

CSE 344 MAY 7 TH EXAM REVIEW

Datalog. Susan B. Davidson. CIS 700: Advanced Topics in Databases MW 1:30-3 Towne 309

NP-Completeness. Algorithms

MapReduce Algorithms. Barna Saha. March 28, 2016

Introduction to Parameterized Complexity

Reductions and Satisfiability

by conservation of flow, hence the cancelation. Similarly, we have

11.1 Facility Location

Theorem 2.9: nearest addition algorithm

Endomorphisms and synchronization, 2: Graphs and transformation monoids. Peter J. Cameron

Treewidth and graph minors

Linear Time Unit Propagation, Horn-SAT and 2-SAT

Endomorphisms and synchronization, 2: Graphs and transformation monoids

arxiv: v1 [cs.db] 23 May 2016

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)

Parallel DBs. April 23, 2018

Clustering. (Part 2)

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

SAT-CNF Is N P-complete

Faster parameterized algorithms for Minimum Fill-In

Confluence Analysis for Distributed Programs: A Model-Theoretic Approach

Conjunctive queries. Many computational problems are much easier for conjunctive queries than for general first-order queries.

Throughput-Optimal Broadcast in Wireless Networks with Point-to-Multipoint Transmissions

View-based query processing: On the relationship between rewriting, answering and losslessness

Faster parameterized algorithms for Minimum Fill-In

Regular Expressions for Data Words

SQL s Three-Valued Logic and Certain Answers

a standard database system

Shannon Switching Game

Introduction to MapReduce Algorithms and Analysis

Relative Information Completeness

Checking for k-anonymity Violation by Views

Shannon capacity and related problems in Information Theory and Ramsey Theory

Consistency and Set Intersection

Ontology and Database Systems: Foundations of Database Systems

Lecture 22 Acyclic Joins and Worst Case Join Results Instructor: Sudeepa Roy

Lecture Notes on Program Equivalence

3 No-Wait Job Shops with Variable Processing Times

Database Theory VU , SS Introduction: Relational Query Languages. Reinhard Pichler

ARELAY network consists of a pair of source and destination

However, this is not always true! For example, this fails if both A and B are closed and unbounded (find an example).

Checking Containment of Schema Mappings (Preliminary Report)

Towards a Logical Reconstruction of Relational Database Theory

Computational problems. Lecture 2: Combinatorial search and optimisation problems. Computational problems. Examples. Example

FASTER UPPER BOUNDING OF INTERSECTION SIZES

Uncertain Data Models

Transcription:

Logical Aspects of Massively Parallel and Distributed Systems Frank Neven Hasselt University PODS Tutorial June 29, 2016 PODS June 29, 2016 1 / 62

Logical aspects of massively parallel and distributed systems Topics Complexity of query evaluation Foundations of query optimization Monotone recursive queries Setting synchronized parallel systems asynchronous distributed systems Introduction PODS June 29, 2016 2 / 62

Topic #1: complexity of query evaluation synchronous setting Question How can we understand the complexity of query processing on shared-nothing parallel architectures? Introduction PODS June 29, 2016 3 / 62

Topic #1: complexity of query evaluation synchronous setting Question How can we understand the complexity of query processing on shared-nothing parallel architectures? Examples: MapReduce, PigLatin, Hive, Dremel, Shark,... Introduction PODS June 29, 2016 3 / 62

Topic #1: complexity of query evaluation synchronous setting Question How can we understand the complexity of query processing on shared-nothing parallel architectures? Examples: MapReduce, PigLatin, Hive, Dremel, Shark,... Characteristics: Large numbers of servers Computation proceeds in rounds consisting of a communication and computation phase Introduction PODS June 29, 2016 3 / 62

Topic #1: complexity of query evaluation synchronous setting Question How can we understand the complexity of query processing on shared-nothing parallel architectures? Examples: MapReduce, PigLatin, Hive, Dremel, Shark,... Characteristics: Large numbers of servers Computation proceeds in rounds consisting of a communication and computation phase Focus: join queries and Shares/HyperCube algorithm Introduction PODS June 29, 2016 3 / 62

Topic #2: foundations of query optimization synchronous setting Question How can we avoid reshuffling of data when evaluating queries? Introduction PODS June 29, 2016 4 / 62

Topic #2: foundations of query optimization synchronous setting Question How can we avoid reshuffling of data when evaluating queries? Framework for reasoning on data partitioning Parallel-correctness and transferability Focus: join queries and single-round parallel algorithms Introduction PODS June 29, 2016 4 / 62

Topic #3: Datalog and monotone queries asynchronous setting Question When can we avoid synchronization barriers in asynchronous parallel systems? Introduction PODS June 29, 2016 5 / 62

Topic #3: Datalog and monotone queries asynchronous setting Question When can we avoid synchronization barriers in asynchronous parallel systems? Coordination-freeness CALM: consistency and logical monotonicity Focus: monotone and Datalog queries (and extensions) Introduction PODS June 29, 2016 5 / 62

Outline 1 Introduction 2 Complexity of parallel query processing Massively Parallel Communication Model Single-Round MPC: Shares/HyperCube 3 Reasoning about data partitioning 4 Avoiding coordination 5 Discussion Complexity of parallel query processing PODS June 29, 2016 6 / 62

Outline 1 Introduction 2 Complexity of parallel query processing Massively Parallel Communication Model Single-Round MPC: Shares/HyperCube 3 Reasoning about data partitioning 4 Avoiding coordination 5 Discussion Complexity of parallel query processing Massively Parallel Communication Model PODS June 29, 2016 7 / 62

Massively Parallel Communication Model (MPC) Aim of MPC [Koutris, Suciu, PODS 2011] Understand the complexity of parallel query processing on shared-nothing architectures Examples MapReduce, Spark, Pig, Hive, Dremel,... Complexity of parallel query processing Massively Parallel Communication Model PODS June 29, 2016 8 / 62

Massively Parallel Communication Model (MPC) Aim of MPC [Koutris, Suciu, PODS 2011] Understand the complexity of parallel query processing on shared-nothing architectures Examples MapReduce, Spark, Pig, Hive, Dremel,... Characteristics Computation is performed by p servers connected by a complete network of private channels Computation proceeds in rounds: Communication phase: servers exchange data Computation phase: each server performs only local computation Complexity of parallel query processing Massively Parallel Communication Model PODS June 29, 2016 8 / 62

Massively Parallel Communication Model Round 1 Round 2 Round 3 Round r INPUT DB 1 1 1 1 DB 12 12 12 12 OUTPUT DB p1 p1 p1 p1 Complexity of parallel query processing Massively Parallel Communication Model PODS June 29, 2016 9 / 62

Massively Parallel Communication Model Round 1 Round 2 Round 3 Round r INPUT DB 1 1 1 1 DB 12 12 12 12 OUTPUT DB p1 p1 p1 p1 Complexity of parallel query processing Massively Parallel Communication Model PODS June 29, 2016 9 / 62

Massively Parallel Communication Model Round 1 Round 2 Round 3 Round r INPUT DB 1 1 1 1 DB 12 12 12 12 OUTPUT DB p1 p1 p1 p1 Complexity of parallel query processing Massively Parallel Communication Model PODS June 29, 2016 9 / 62

Massively Parallel Communication Model Round 1 Round 2 Round 3 Round r INPUT DB 1 1 1 1 DB 12 12 12 12 OUTPUT DB p1 p1 p1 p1 Complexity of parallel query processing Massively Parallel Communication Model PODS June 29, 2016 9 / 62

How do we measure complexity? Possible measures 1 Load: The load at each server is the amount of data received by a server during a particular round. Minimization targets: Total load (communication cost) Maximal load (load balancedness) 2 Number of rounds Typically ignoring the complexity of local computations. Complexity of parallel query processing Massively Parallel Communication Model PODS June 29, 2016 10 / 62

Outline 1 Introduction 2 Complexity of parallel query processing Massively Parallel Communication Model Single-Round MPC: Shares/HyperCube 3 Reasoning about data partitioning 4 Avoiding coordination 5 Discussion Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 11 / 62

Shares/HyperCube algorithm: single-round multi-join evaluation [Afrati, Ullman, EDBT 2010], [Beame, Koutris, Suciu, PODS 2013] Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 12 / 62

Shares/HyperCube algorithm: single-round multi-join evaluation [Afrati, Ullman, EDBT 2010], [Beame, Koutris, Suciu, PODS 2013] Triangle Query H(x, y, z) R(x, y), S(y, z), T (z, x) (3-ary query) Identify every server with a coordinate in the 3-dimensional hypercube α x is the share of variable x (similar for y and z) [1, α x ] [1, α y ] [1, α z ]. Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 12 / 62

Shares/HyperCube algorithm: single-round multi-join evaluation [Afrati, Ullman, EDBT 2010], [Beame, Koutris, Suciu, PODS 2013] Triangle Query H(x, y, z) R(x, y), S(y, z), T (z, x) (3-ary query) Identify every server with a coordinate in the 3-dimensional hypercube α x is the share of variable x (similar for y and z) [1, α x ] [1, α y ] [1, α z ]. hash function h x mapping domain values to [1, α x ] (similar for y and z) Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 12 / 62

Shares/HyperCube algorithm: single-round multi-join evaluation [Afrati, Ullman, EDBT 2010], [Beame, Koutris, Suciu, PODS 2013] Triangle Query H(x, y, z) R(x, y), S(y, z), T (z, x) Communication phase: R(a, b) is sent to every server (h x (a), h y (b), ) (replicating every tuple α z times) Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 13 / 62

Shares/HyperCube algorithm: single-round multi-join evaluation [Afrati, Ullman, EDBT 2010], [Beame, Koutris, Suciu, PODS 2013] Triangle Query H(x, y, z) R(x, y), S(y, z), T (z, x) Communication phase: R(a, b) is sent to every server (h x (a), h y (b), ) (replicating every tuple α z times) S(b, c) is sent to every server (, h y (b), h z (c)) (replicating every tuple α x times) T (c, a) is sent to every server (h x (a),, h z (c)) (replicating every tuple α y times) Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 13 / 62

Shares/HyperCube algorithm: single-round multi-join evaluation [Afrati, Ullman, EDBT 2010], [Beame, Koutris, Suciu, PODS 2013] Triangle Query H(x, y, z) R(x, y), S(y, z), T (z, x) Communication phase: R(a, b) is sent to every server (h x (a), h y (b), ) (replicating every tuple α z times) S(b, c) is sent to every server (, h y (b), h z (c)) (replicating every tuple α x times) T (c, a) is sent to every server (h x (a),, h z (c)) (replicating every tuple α y times) Computation phase: All servers evaluate the triangle query. Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 13 / 62

Shares/HyperCube algorithm: single-round multi-join evaluation [Afrati, Ullman, EDBT 2010], [Beame, Koutris, Suciu, PODS 2013] Triangle Query H(x, y, z) R(x, y), S(y, z), T (z, x) Property For every valuation V = {x a, y b, z c} the required facts {R(a, b), S(b, c), T (c, a)} meet at server with coordinate (h x (a), h y (b), h z (c)) Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 14 / 62

Shares/HyperCube: some results minimize total load: solving Lagrangean equations [Afrati, Ullman, EDBT 2010] Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 15 / 62

Shares/HyperCube: some results minimize total load: solving Lagrangean equations [Afrati, Ullman, EDBT 2010] minimize maximal load [Beame, Koutris, Suciu, PODS 2013, 2014] lower bound: any 1-round algorithm requires at least load M/p 1/τ (Q) per server (τ (Q) is optimal fractional vertex cover number of Q) HyperCube provides matching upper bound Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 15 / 62

Shares/HyperCube: some results minimize total load: solving Lagrangean equations [Afrati, Ullman, EDBT 2010] minimize maximal load [Beame, Koutris, Suciu, PODS 2013, 2014] lower bound: any 1-round algorithm requires at least load M/p 1/τ (Q) per server (τ (Q) is optimal fractional vertex cover number of Q) HyperCube provides matching upper bound Practical? [Chu, Balazinska, Suciu, SIGMOD 2015] [Afrati, Ullman, TKDE 2011] rounding issues strong for queries with large intermediate results weak on queries with small output Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 15 / 62

Intermediate wrap-up: Summary: MPC as a model to study parallel query evaluation Shares/HyperCube fundamental algorithm Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 16 / 62

Intermediate wrap-up: Summary: MPC as a model to study parallel query evaluation Shares/HyperCube fundamental algorithm Research opportunities: Skew [Beame, Koutris, Suciu, PODS 2014] [Afrati, Stasinopoulos, Ullman, Vassilakopoulos, 2015] Multi-round GYM [Afrati, Joglekar, R, Salihoglu, Ullman, 2014] lower-bound: any multi-round algorithm requires at least load M/p 1/ρ (Q) per server (ρ (Q) is optimal fractional edge cover number of Q) [Beame, Koutris, Suciu, ICDT 2016] matching upper bound for binary relations [Ketsman, Suciu, 2016] Complexity of parallel query processing Single-Round MPC: Shares/HyperCube PODS June 29, 2016 16 / 62

Outline 1 Introduction 2 Complexity of parallel query processing 3 Reasoning about data partitioning Parallel-Correctness Transferability of parallel-correctness 4 Avoiding coordination 5 Discussion Reasoning about data partitioning PODS June 29, 2016 17 / 62

Observations on HyperCube Distribution policies HyperCube reshuffles data on the granularity of facts Reasoning about data partitioning PODS June 29, 2016 18 / 62

Observations on HyperCube Distribution policies HyperCube reshuffles data on the granularity of facts Can be modeled by a distribution policy P: a function mapping every fact f to a subset of servers P(f) Reasoning about data partitioning PODS June 29, 2016 18 / 62

Observations on HyperCube Distribution policies HyperCube reshuffles data on the granularity of facts Can be modeled by a distribution policy P: a function mapping every fact f to a subset of servers P(f) Generic one-round algorithm (relative to a distribution policy P and a query Q) 1 Reshuffle all data according to P 2 Evaluate Q locally at every server 3 Output then is the union of all local results Reasoning about data partitioning PODS June 29, 2016 18 / 62

Observations on HyperCube Distribution policies HyperCube reshuffles data on the granularity of facts Can be modeled by a distribution policy P: a function mapping every fact f to a subset of servers P(f) Generic one-round algorithm (relative to a distribution policy P and a query Q) 1 Reshuffle all data according to P 2 Evaluate Q locally at every server 3 Output then is the union of all local results Potential for query optimization Can we avoid the reshuffle step in the generic one-round algorithm? Reasoning about data partitioning PODS June 29, 2016 18 / 62

Reasoning on data distribution First scenario. The data is already distributed over the servers. Can we use the generic one-round algorithm to evaluate a given query using the current distribution? if yes: no data reshuffling needed if no: choose another distribution policy that works Reasoning about data partitioning PODS June 29, 2016 19 / 62

Reasoning on data distribution First scenario. The data is already distributed over the servers. Can we use the generic one-round algorithm to evaluate a given query using the current distribution? if yes: no data reshuffling needed if no: choose another distribution policy that works Decision problem: parallel-correctness Reasoning about data partitioning PODS June 29, 2016 19 / 62

Reasoning on data distribution Second scenario. It may be unpractical to reason about distribution policies: too complex current distribution policy is unknown or hidden not chosen yet Reasoning about data partitioning PODS June 29, 2016 20 / 62

Reasoning on data distribution Second scenario. It may be unpractical to reason about distribution policies: too complex current distribution policy is unknown or hidden not chosen yet Looking for ways to infer that two queries can always be evaluated correctly after another without an intermediate reshuffling step. Reasoning about data partitioning PODS June 29, 2016 20 / 62

Reasoning on data distribution Second scenario. It may be unpractical to reason about distribution policies: too complex current distribution policy is unknown or hidden not chosen yet Looking for ways to infer that two queries can always be evaluated correctly after another without an intermediate reshuffling step. Decision problem: parallel-correctness transfer Reasoning about data partitioning PODS June 29, 2016 20 / 62

Outline 1 Introduction 2 Complexity of parallel query processing 3 Reasoning about data partitioning Parallel-Correctness Transferability of parallel-correctness 4 Avoiding coordination 5 Discussion Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 21 / 62

Parallel-correctness I P DB I 1 1 Q(I 1 ) DB I 2 1 Q(I 2 ) OUTPUT [Q, P](I) = S j Q(I j) DB I p 1 I p Q(I p ) central execution Q(I) =[Q,? P](I) distributed execution Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 22 / 62

Parallel-correctness I P DB I 1 1 Q(I 1 ) DB I 2 1 Q(I 2 ) OUTPUT [Q, P](I) = S j Q(I j) DB I p 1 I p Q(I p ) centralized central execution evaluation Q(I) =[Q,? P](I) distributed evaluation execution Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 22 / 62

Parallel-correctness: a bit more formal Definition A query Q is parallel-correct on I w.r.t. P iff Q(I ) = [Q, P](I ). If Q is monotone, then always Q(I ) [Q, P](I ) Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 23 / 62

Parallel-correctness: a bit more formal Definition A query Q is parallel-correct on I w.r.t. P iff Q(I ) = [Q, P](I ). If Q is monotone, then always Q(I ) [Q, P](I ) Definition A query Q is parallel-correct w.r.t. P iff Q is parallel-correct w.r.t. P on every I. Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 23 / 62

Parallel-correctness for conjunctive queries Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 24 / 62

Parallel-correctness for conjunctive queries A valuation V for a conjunctive query Q : H(x, z) R(x, y), S(y, z) }{{}}{{} head Q body Q is a mapping from the variables of Q to domain elements. Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 24 / 62

Parallel-correctness for conjunctive queries A valuation V for a conjunctive query Q : H(x, z) R(x, y), S(y, z) }{{}}{{} head Q body Q is a mapping from the variables of Q to domain elements. If V (body Q ) I then V (head Q ) Q(I ). Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 24 / 62

Parallel-correctness for conjunctive queries A valuation V for a conjunctive query Q : H(x, z) R(x, y), S(y, z) }{{}}{{} head Q body Q is a mapping from the variables of Q to domain elements. If V (body Q ) I then V (head Q ) Q(I ). Observation If for every valuation V for Q, there is a node κ in the network for which then Q is parallel-correct w.r.t. P V (body Q ) P 1 (κ), ( ) Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 24 / 62

Parallel-correctness for conjunctive queries A valuation V for a conjunctive query Q : H(x, z) R(x, y), S(y, z) }{{}}{{} head Q body Q is a mapping from the variables of Q to domain elements. If V (body Q ) I then V (head Q ) Q(I ). Observation If for every valuation V for Q, there is a node κ in the network for which then Q is parallel-correct w.r.t. P V (body Q ) P 1 (κ), ( ) ( ) implies that for every I, Q(I ) [Q, P](I ) Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 24 / 62

Parallel-correctness for conjunctive queries A valuation V for a conjunctive query Q : H(x, z) R(x, y), S(y, z) }{{}}{{} head Q body Q is a mapping from the variables of Q to domain elements. If V (body Q ) I then V (head Q ) Q(I ). Observation If for every valuation V for Q, there is a node κ in the network for which then Q is parallel-correct w.r.t. P V (body Q ) P 1 (κ), ( ) ( ) implies that for every I, Q(I ) [Q, P](I ) Q(I ) [Q, P](I ) follows by monotonicity Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 24 / 62

Parallel-correctness for conjunctive queries A valuation V for a conjunctive query Q : H(x, z) R(x, y), S(y, z) }{{}}{{} head Q body Q is a mapping from the variables of Q to domain elements. If V (body Q ) I then V (head Q ) Q(I ). Observation If for every valuation V for Q, there is a node κ in the network for which then Q is parallel-correct w.r.t. P V (body Q ) P 1 (κ), ( ) ( ) implies that for every I, Q(I ) [Q, P](I ) Q(I ) [Q, P](I ) follows by monotonicity Every CQ is parallel-correct w.r.t. its HyperCube distribution Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 24 / 62

(PC0) not Necessary Example Sufficient but not a necessary condition: counterexample Distribution policy P all {R(a, b)} all {R(b, a)} Query Q: T (x, z) Q : H(x, R(x, z) y),r(y, R(x, z),r(x, y), R(y, x) z), R(x, x) V = {x, z a, y b} Requires: R(a, b) R(b, a) R(a, a) Derives: Do not meet T (a, a) = V = {x, y, z a} Requires: R(a, a) Derives: T (a, a) Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 25 / 62

(PC0) not Necessary Example Sufficient but not a necessary condition: counterexample Distribution policy P all {R(a, b)} all {R(b, a)} Query Q: T (x, z) Q : H(x, R(x, z) y),r(y, R(x, z),r(x, y), R(y, x) z), R(x, x) V = {x, z a, y b} V = {x, z a, y b} V = {x, y, z a} Derives: Requires: H(a, a) Requires: V R(a, (body b) R(b, a) R(a, a) R(a, a) Q ) requires: Derives: R(a, b) R(b, Do a) not R(a, meeta) Derives: κ T (a, : V a) (body Q ) P 1 (κ) = T (a, a) Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 25 / 62

(PC0) not Necessary Example Sufficient but not a necessary condition: counterexample Distribution policy P all {R(a, b)} all {R(b, a)} Query Q: T (x, z) Q : H(x, R(x, z) y),r(y, R(x, z),r(x, y), R(y, x) z), R(x, x) V = {x, z a, y b} V = {x, y, z a} V = {x, z a, y b} V = {x, y, z a} Derives: Derives: Requires: H(a, a) Requires: H(a, a) V R(a, (body b) R(b, a) R(a, a) Q ) requires: Derives: R(a, b) R(b, Do a) not R(a, meeta) V R(a, (bodya) Q ) requires: Derives: R(a, a) κ T (a, : V a) (body Q ) P 1 (κ) = κ T : V (a, (body a) Q ) P 1 (κ) Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 25 / 62

Parallel-correctness for CQs: characterization Lemma Q is parallel-correct w.r.t. P iff for every minimal valuation V for Q, there is a node κ in the network for which V (body Q ) P 1 (κ). Definition V is minimal if no V exists, where V (head Q ) = V (head Q ); and, V (body Q ) V (body Q ). Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 26 / 62

Parallel-correctness for CQs: complexity Lemma Q is parallel-correct w.r.t. P iff for every minimal valuation V for Q, there is a node κ in the network for which V (body Q ) P 1 (κ). Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 27 / 62

Parallel-correctness for CQs: complexity Lemma Q is parallel-correct w.r.t. P iff for every minimal valuation V for Q, there is a node κ in the network for which V (body Q ) P 1 (κ). bound on the size of representations of nodes κ bound on the complexity of the test V (body Q ) P 1 (κ). Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 27 / 62

Parallel-correctness for CQs: complexity Lemma Q is parallel-correct w.r.t. P iff for every minimal valuation V for Q, there is a node κ in the network for which V (body Q ) P 1 (κ). bound on the size of representations of nodes κ bound on the complexity of the test V (body Q ) P 1 (κ). Theorem (Ameloot, Geck, Ketsman, N., Schwentick, 2015) Deciding whether a CQ is parallel-correct w.r.t. P is Π P 2 -complete. Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 27 / 62

Parallel-correctness for CQs: complexity Lemma Q is parallel-correct w.r.t. P iff for every minimal valuation V for Q, there is a node κ in the network for which V (body Q ) P 1 (κ). bound on the size of representations of nodes κ bound on the complexity of the test V (body Q ) P 1 (κ). Theorem (Ameloot, Geck, Ketsman, N., Schwentick, 2015) Deciding whether a CQ is parallel-correct w.r.t. P is Π P 2 -complete. Reduces to reasoning on properties of minimal valuations. Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 27 / 62

Parallel-correctness beyond CQs: adding unions, inequalities, negation Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a UCQ is parallel-correct is Π P 2 -complete. Reduces again to reasoning on minimal valuations. Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 28 / 62

Parallel-correctness beyond CQs: adding unions, inequalities, negation Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a UCQ is parallel-correct is Π P 2 -complete. Reduces again to reasoning on minimal valuations. Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a CQ is parallel-correct is conexptime-complete. Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 28 / 62

Parallel-correctness beyond CQs: adding unions, inequalities, negation Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a UCQ is parallel-correct is Π P 2 -complete. Reduces again to reasoning on minimal valuations. Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a CQ is parallel-correct is conexptime-complete. Non-monotone: parallel-soundness, parallel-completeness Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 28 / 62

Parallel-correctness beyond CQs: adding unions, inequalities, negation Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a UCQ is parallel-correct is Π P 2 -complete. Reduces again to reasoning on minimal valuations. Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a CQ is parallel-correct is conexptime-complete. Non-monotone: parallel-soundness, parallel-completeness Upper bound: bound on size of smallest counterexample. Lower bound: reduction from CQ containment Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 28 / 62

Parallel-correctness beyond CQs: adding unions, inequalities, negation Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a UCQ is parallel-correct is Π P 2 -complete. Reduces again to reasoning on minimal valuations. Theorem (Geck, Ketsman, N., Schwentick, 2016) Deciding whether a CQ is parallel-correct is conexptime-complete. Non-monotone: parallel-soundness, parallel-completeness Upper bound: bound on size of smallest counterexample. Lower bound: reduction from CQ containment Requires reasoning on possible counterexamples that can be of exponential size. Reasoning about data partitioning Parallel-Correctness PODS June 29, 2016 28 / 62

Outline 1 Introduction 2 Complexity of parallel query processing 3 Reasoning about data partitioning Parallel-Correctness Transferability of parallel-correctness 4 Avoiding coordination 5 Discussion Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 29 / 62

Evaluating Q after Q (for free) class of all distribution policies parallel correct for Q parallel correct for Q Q can not be evaluated for free after Q Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 30 / 62

Evaluating Q after Q (for free) class of all distribution policies parallel correct for Q parallel correct for Q Q can sometimes be evaluated for free after Q Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 30 / 62

Evaluating Q after Q (for free) class of all distribution policies parallel correct for Q parallel correct for Q Q can always be evaluated for free after Q Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 30 / 62

Transferability of parallel-correctness Definition Parallel-correctness transfers from Q to Q, denoted Q T Q, iff Q is parallel-correct on every distribution policy for which Q is parallel-correct. Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 31 / 62

Transferability of parallel-correctness Definition Parallel-correctness transfers from Q to Q, denoted Q T Q, iff Q is parallel-correct on every distribution policy for which Q is parallel-correct. Q() R(x, y), R(y, z), R(z, w)? T Q () R(x, y), R(y, x) Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 31 / 62

Transferability of parallel-correctness Definition Parallel-correctness transfers from Q to Q, denoted Q T Q, iff Q is parallel-correct on every distribution policy for which Q is parallel-correct. Q() R(x, y), R(y, z), R(z, w)? T Q () R(x, y), R(y, x) a b c d a b c a b a facts required by V (body Q ) Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 31 / 62

Transferability of parallel-correctness Definition Parallel-correctness transfers from Q to Q, denoted Q T Q, iff Q is parallel-correct on every distribution policy for which Q is parallel-correct. Q() R(x, y), R(y, z), R(z, w)? T Q () R(x, y), R(y, x) a b c d a b c a b a a b a facts required by V (body Q ) facts required by V (body Q ) Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 31 / 62

Transferability for CQs: characterization and complexity Lemma For conjunctive queries Q and Q, Q T Q iff for every minimal valuation V for Q there is a minimal valuation V for Q such that V (body Q ) V (body Q ). Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 32 / 62

Transferability for CQs: characterization and complexity Lemma For conjunctive queries Q and Q, Q T Q iff for every minimal valuation V for Q there is a minimal valuation V for Q such that V (body Q ) V (body Q ). Theorem (Ameloot, Geck, Ketsman, N., Schwentick, 2015) Deciding Q T Q is Π P 3 -complete. Only depends on the size of queries! Independent on representation of distribution policies. Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 32 / 62

Lowering complexity Lemma For conjunctive queries Q and Q, Q T Q iff for every minimal valuation V for Q there is a minimal valuation V for Q such that V (body Q ) V (body Q ). Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 33 / 62

Lowering complexity Lemma For conjunctive queries Q and Q, Q T Q iff for every minimal valuation V for Q there is a minimal valuation V for Q such that Strongly minimal CQs V (body Q ) V (body Q ). A CQ is strongly minimal if every valuation is minimal Example: full CQs, CQs without self-joins,... Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 33 / 62

Lowering complexity Lemma For conjunctive queries Q and Q, Q T Q iff for every minimal valuation V for Q there is a minimal valuation V for Q such that Strongly minimal CQs Theorem V (body Q ) V (body Q ). A CQ is strongly minimal if every valuation is minimal Example: full CQs, CQs without self-joins,... Let Q be a strongly minimal CQ and Q be a CQ. Deciding Q T Q is NP-complete. Deciding parallel-correctness of Q w.r.t. a distribution policy P is in conp. Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 33 / 62

Intermediate wrap-up: parallel-correctness and transferability Summary: Framework for reasoning about correctness of arbitrary distribution policies Intuitive characterization for CQs in terms of minimal valuations Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 34 / 62

Intermediate wrap-up: parallel-correctness and transferability Summary: Framework for reasoning about correctness of arbitrary distribution policies Intuitive characterization for CQs in terms of minimal valuations Research opportunities: Current setting: no tractable restriction decidability frontier for more expressive query languages Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 34 / 62

Intermediate wrap-up: parallel-correctness and transferability Summary: Framework for reasoning about correctness of arbitrary distribution policies Intuitive characterization for CQs in terms of minimal valuations Research opportunities: Current setting: no tractable restriction decidability frontier for more expressive query languages Extended setting: more liberal single-round algorithms multi-round algorithms Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 34 / 62

Intermediate wrap-up: parallel-correctness and transferability Summary: Framework for reasoning about correctness of arbitrary distribution policies Intuitive characterization for CQs in terms of minimal valuations Research opportunities: Current setting: no tractable restriction decidability frontier for more expressive query languages Extended setting: more liberal single-round algorithms multi-round algorithms Practical considerations e.g., if not-parallel correct, minimal way to move to a PC one Reasoning about data partitioning Transferability of parallel-correctness PODS June 29, 2016 34 / 62

Outline 1 Introduction 2 Complexity of parallel query processing 3 Reasoning about data partitioning 4 Avoiding coordination CALM-conjecture by example Coordination-free computation CALM-theorems 5 Discussion Avoiding coordination PODS June 29, 2016 35 / 62

Synchronous versus asynchronous MPC makes synchronization explicit by modeling computation as a sequence of rounds (communication/computation sequence) Avoiding coordination PODS June 29, 2016 36 / 62

Synchronous versus asynchronous MPC makes synchronization explicit by modeling computation as a sequence of rounds (communication/computation sequence) Asynchronous computation model: computation nodes are allowed to communicate freely synchronization can be implicit Avoiding coordination PODS June 29, 2016 36 / 62

Synchronous versus asynchronous MPC makes synchronization explicit by modeling computation as a sequence of rounds (communication/computation sequence) Asynchronous computation model: computation nodes are allowed to communicate freely synchronization can be implicit Declarative distributed computing: approach where distributed computations are programmed using extensions of Datalog Examples: Webdamlog [Abiteboul et al. 2013], Netlog [Grumbach, Wang, 2010], Dedalus [Hellerstein 2010], NDlog [Loo et al, 2006], D [Ma et al, 2013],... Avoiding coordination PODS June 29, 2016 36 / 62

Synchronous versus asynchronous MPC makes synchronization explicit by modeling computation as a sequence of rounds (communication/computation sequence) Asynchronous computation model: computation nodes are allowed to communicate freely synchronization can be implicit Declarative distributed computing: approach where distributed computations are programmed using extensions of Datalog Examples: Webdamlog [Abiteboul et al. 2013], Netlog [Grumbach, Wang, 2010], Dedalus [Hellerstein 2010], NDlog [Loo et al, 2006], D [Ma et al, 2013],... Our focus: Which fragments/extensions of Datalog can be asynchronously evaluated in a coordination-free manner? Setting: messages can never be lost but can be arbitrarily delayed. Requirement: output can never be retracted, should eventually be complete Avoiding coordination PODS June 29, 2016 36 / 62

Outline 1 Introduction 2 Complexity of parallel query processing 3 Reasoning about data partitioning 4 Avoiding coordination CALM-conjecture by example Coordination-free computation CALM-theorems 5 Discussion Avoiding coordination CALM-conjecture by example PODS June 29, 2016 37 / 62

Example computing node A Query: select all triangles computing node B C computing node input graph Avoiding coordination CALM-conjecture by example PODS June 29, 2016 38 / 62

Example computing node A Query: select all triangles computing node B C computing node input graph Avoiding coordination CALM-conjecture by example PODS June 29, 2016 38 / 62

Example computing node A Query: select all triangles computing node B Naive algorithm: C Gather all data at all nodes Output triangles whenever new data arrives computing node input graph Avoiding coordination CALM-conjecture by example PODS June 29, 2016 38 / 62

Example computing node A Query: select all triangles computing node B Naive algorithm: C - eventually consistent - no coordination Gather all data at all nodes Output triangles whenever new data arrives computing node input graph Avoiding coordination CALM-conjecture by example PODS June 29, 2016 38 / 62

Example computing node A Query: select all open triangles computing node B C computing node input graph Avoiding coordination CALM-conjecture by example PODS June 29, 2016 39 / 62

Example computing node A Query: select all open triangles computing node B??? computing node C input graph Avoiding coordination CALM-conjecture by example PODS June 29, 2016 39 / 62

Example computing node A Query: select all open triangles computing node B requires global coordination??? computing node C input graph Avoiding coordination CALM-conjecture by example PODS June 29, 2016 39 / 62

CALM: Consistency And Logical Monotonicity CALM-conjecture [Hellerstein, PODS 2010] A query has a coordination-free and eventually consistent execution strategy iff the query is monotone Avoiding coordination CALM-conjecture by example PODS June 29, 2016 40 / 62

CALM: Consistency And Logical Monotonicity CALM-conjecture [Hellerstein, PODS 2010] A query has a coordination-free and eventually consistent execution strategy iff the query is monotone [Ameloot, N., Van den Bussche, PODS 2011]: TRUE (relational transducer networks) Avoiding coordination CALM-conjecture by example PODS June 29, 2016 40 / 62

CALM: Consistency And Logical Monotonicity CALM-conjecture [Hellerstein, PODS 2010] A query has a coordination-free and eventually consistent execution strategy iff the query is monotone [Ameloot, N., Van den Bussche, PODS 2011]: TRUE (relational transducer networks) [Zinn, Green, Ludäscher, ICDT 2012]: FALSE when nodes have more knowledge on how data is distributed (through distribution policies) Avoiding coordination CALM-conjecture by example PODS June 29, 2016 40 / 62

CALM: Consistency And Logical Monotonicity CALM-conjecture [Hellerstein, PODS 2010] A query has a coordination-free and eventually consistent execution strategy iff the query is monotone [Ameloot, N., Van den Bussche, PODS 2011]: TRUE (relational transducer networks) [Zinn, Green, Ludäscher, ICDT 2012]: FALSE when nodes have more knowledge on how data is distributed (through distribution policies) [Ameloot, Ketsman, N., Zinn, PODS 2014]: TRUE when also refining monotonicity Avoiding coordination CALM-conjecture by example PODS June 29, 2016 40 / 62

Outline 1 Introduction 2 Complexity of parallel query processing 3 Reasoning about data partitioning 4 Avoiding coordination CALM-conjecture by example Coordination-free computation CALM-theorems 5 Discussion Avoiding coordination Coordination-free computation PODS June 29, 2016 41 / 62

Computation model: relational transducer networks [Ameloot, N., Van den Bussche, 2011] Relational Transducer Ne H(x) state H(y) state [Ameloot, N based on relational transducers [Abiteboul, Vianu, Fordham, Yesha, PODS 1998] transducer program node x node y program program state H(u) H(z) state node u node z program program Avoiding coordination Coordination-free computation PODS June 29, 2016 42 / 62

Computation model: relational transducer networks [Ameloot, N., Van den Bussche, 2011] Relational Transducer Ne transducer program program H(x) state node x H(y) state node [Ameloot, N y program based on relational transducers [Abiteboul, Vianu, Fordham, Yesha, PODS 1998] differences with MPC state H(u) H(z) state node u node z program program Avoiding coordination Coordination-free computation PODS June 29, 2016 42 / 62

Computation model: relational transducer networks [Ameloot, N., Van den Bussche, 2011] Relational Transducer Ne transducer program program H(x) state node state x H(u) H(y) H(z) state node state [Ameloot, N y program based on relational transducers [Abiteboul, Vianu, Fordham, Yesha, PODS 1998] differences with MPC initial start distribution H (can be modelled by a distribution policy P H ) node u node z program program Avoiding coordination Coordination-free computation PODS June 29, 2016 42 / 62

Computation model: relational transducer networks [Ameloot, N., Van den Bussche, 2011] Relational Transducer Ne transducer program program H(x) state node state x H(u) H(y) H(z) state node state [Ameloot, N y program based on relational transducers [Abiteboul, Vianu, Fordham, Yesha, PODS 1998] differences with MPC initial start distribution H (can be modelled by a distribution policy P H ) every node runs same program Π node u node z program program Avoiding coordination Coordination-free computation PODS June 29, 2016 42 / 62

Computation model: relational transducer networks [Ameloot, N., Van den Bussche, 2011] Relational Transducer Ne transducer program program program H(x) state node state node x H(u) u H(y) H(z) state node state node [Ameloot, N y program z program based on relational transducers [Abiteboul, Vianu, Fordham, Yesha, PODS 1998] differences with MPC initial start distribution H (can be modelled by a distribution policy P H ) every node runs same program Π no rounds, nodes can send messages to each other (to further reshuffle data) Avoiding coordination Coordination-free computation PODS June 29, 2016 42 / 62

Computation model: relational transducer networks [Ameloot, N., Van den Bussche, 2011] Relational Transducer Ne transducer program program program H(x) state node state node x H(u) u H(y) H(z) state node state node [Ameloot, N y program z program based on relational transducers [Abiteboul, Vianu, Fordham, Yesha, PODS 1998] differences with MPC initial start distribution H (can be modelled by a distribution policy P H ) every node runs same program Π no rounds, nodes can send messages to each other (to further reshuffle data) message can never get lost, but can take arbitrarily long to arrive Avoiding coordination Coordination-free computation PODS June 29, 2016 42 / 62

Computation model: relational transducer networks [Ameloot, N., Van den Bussche, 2011] Relational Transducer Ne transducer program program program H(x) state node state node x H(u) u H(y) H(z) state node state node [Ameloot, N y program z program based on relational transducers [Abiteboul, Vianu, Fordham, Yesha, PODS 1998] differences with MPC initial start distribution H (can be modelled by a distribution policy P H ) every node runs same program Π no rounds, nodes can send messages to each other (to further reshuffle data) message can never get lost, but can take arbitrarily long to arrive computes queries: inflationary and eventually consistent semantics Avoiding coordination Coordination-free computation PODS June 29, 2016 42 / 62

Computing all queries Observation Relational transducer networks compute every query Avoiding coordination Coordination-free computation PODS June 29, 2016 43 / 62

Computing all queries Observation Relational transducer networks compute every query Idea. Broadcast all data. Needs coordination (messages can be delayed). Locally evaluate query. Avoiding coordination Coordination-free computation PODS June 29, 2016 43 / 62

Computing all queries Computing all queries Observation Relational transducer networks compute every query [Ameloot, N., Van den Bussche, 2011] Theorem Relational transducer networks compute every query Idea. Broadcast Idea all Gather data. all Needs data. coordination Needs coordination (messages (messages can be can delayed). be delayed). Locally evaluate Locally query. evaluate query. node..., (R( d 2),x), (R( d 1),x) node x y Avoiding coordination Coordination-free computation PODS June 29, 2016 43 / 62

Computing all queries Computing all queries Observation Relational transducer networks compute every query Theorem Relational transducer networks compute every query Idea. Broadcast Idea all Gather data. all Needs data. coordination Needs coordination (messages (messages can becan delayed). be delayed). Locally evaluate Locally query. evaluate query. node acknowledge every tuple node x y Avoiding coordination Coordination-free computation PODS June 29, 2016 43 / 62

Computing all queries Computing all queries Observation Relational transducer networks compute every query Theorem Relational transducer networks compute every query Idea. Broadcast Idea all Gather data. all Needs data. coordination Needs coordination (messages (messages can be can delayed). be delayed). Locally evaluate Locally query. evaluate query. node done node x y Avoiding coordination Coordination-free computation PODS June 29, 2016 43 / 62

Computing all queries Observation Relational transducer networks compute every query Theorem Relational transducer networks compute every que Idea. Idea Gather all data. Needs coordination (messages can be Broadcast all data. Needs coordination (messages can be delayed). Locally evaluate query. Computing all queries Locally evaluate query. node node x node y global coordination node node need to know every node in the network: relation All need to know every node in the network Avoiding coordination Coordination-free computation PODS June 29, 2016 43 / 62

Coordination: intuition Coordination Gobal consensus Reduces parallellism Avoiding coordination Coordination-free computation PODS June 29, 2016 44 / 62

Coordination: intuition Coordination Gobal consensus Reduces parallellism Coordination-free Embarrassingly parallel execution Need communication to transfer data Avoiding coordination Coordination-free computation PODS June 29, 2016 44 / 62

Coordination: intuition Coordination Gobal consensus Reduces parallellism Coordination-free Embarrassingly parallel execution Need communication to transfer data Goal Separate data-communication from coordination-communication Avoiding coordination Coordination-free computation PODS June 29, 2016 44 / 62

Coordination-freeness Informal Definition A relational transducer network Π is coordination-free if for all input databases I there is an ideal initial distribution P H,I on which Π computes the query without reading input messages. Avoiding coordination Coordination-free computation PODS June 29, 2016 45 / 62

Coordination-freeness Informal Definition A relational transducer network Π is coordination-free if for all input databases I there is an ideal initial distribution P H,I on which Π computes the query without reading input messages. Intuition: On ideal distribution: communication but no coordination On non-ideal distribution: only communication for data transfer, not for coordination Avoiding coordination Coordination-free computation PODS June 29, 2016 45 / 62

Example of coordination-freeness: output all triangles Transducer program Broadcast local edges Output a triangle when one can be derived Coordination-free: Ideal distribution: whole database on one node Query is computed by only heartbeat transitions Avoiding coordination Coordination-free computation PODS June 29, 2016 46 / 62

Outline 1 Introduction 2 Complexity of parallel query processing 3 Reasoning about data partitioning 4 Avoiding coordination CALM-conjecture by example Coordination-free computation CALM-theorems 5 Discussion Avoiding coordination CALM-theorems PODS June 29, 2016 47 / 62

CALM-Theorem (0) Theorem (Ameloot, N., Van den Bussche, PODS 2011) The following are equivalent. Query Q is computable by a coordination-free relational transducer network; computable by an oblivious relational transducer network; and, monotone. oblivious: not knowing the identities of all other nodes in the network Avoiding coordination CALM-theorems PODS June 29, 2016 48 / 62

CALM-Theorem (0) Theorem (Ameloot, N., Van den Bussche, PODS 2011) The following are equivalent. Query Q is computable by a coordination-free relational transducer network; computable by an oblivious relational transducer network; and, monotone. oblivious: not knowing the identities of all other nodes in the network Corollary: coordination-free computations can only define monotone queries Avoiding coordination CALM-theorems PODS June 29, 2016 48 / 62

CALM-Theorem (0) Theorem (Ameloot, N., Van den Bussche, PODS 2011) The following are equivalent. Query Q is computable by a coordination-free relational transducer network; computable by an oblivious relational transducer network; and, monotone. oblivious: not knowing the identities of all other nodes in the network Corollary: coordination-free computations can only define monotone queries Complete language for coordination-free computation: language defining all monotone queries e.g., Datalog with inequalities and value invention [Hull, Yoshikawa, 1990] [Cabibbo, 1998] Avoiding coordination CALM-theorems PODS June 29, 2016 48 / 62

Weaker forms of monotonicity Definition A query Q is monotone if Q(I ) Q(I J) for all instances I and J. Observation If Q is monotone then Q(I s ) Q(I ) for any I s I. Avoiding coordination CALM-theorems PODS June 29, 2016 49 / 62

Weaker forms of monotonicity Definition A query Q is domain-distinct-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain distinct from I. Avoiding coordination CALM-theorems PODS June 29, 2016 50 / 62

Weaker forms of monotonicity Definition A query Q is domain-distinct-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain distinct from I. Example Definition Monotonicity Selecting open triangles in a graph is domain-distinct-monotone. Example A query Q is monotone if Q(I) Q(I [ J) for all database instances I and J. select open triangles in graph is not monotone a a c d b c d b c d I Q(I) Avoiding coordination CALM-theorems PODS June 29, 2016 50 / 62

Weaker forms of monotonicity Definition A query Q is domain-distinct-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain distinct from I. Example Domain-distinct-monotonicity Selecting open triangles Example inselect a open graph triangles is domain-distinct-monotone. graph 2 M distinct a a b c d c d b c d I Q(I) not domain distinct from I Avoiding coordination CALM-theorems PODS June 29, 2016 50 / 62

Weaker forms of monotonicity Definition A query Q is domain-distinct-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain distinct from I. Example Domain-distinct-monotonicity Example complement of transitive-closure TC(x, y) E(x, y) M distinct Complement of the transitive TC(x, closure y) of E(x, az),tc(z,y) graph is not domain-distinct-monotone. O(x, y) TC(x, y),x6= y } stratified Datalog stratum 1 2 } stratum 2 a b a b I Q(I) Avoiding coordination CALM-theorems PODS June 29, 2016 50 / 62

Weaker forms of monotonicity Definition A query Q is domain-distinct-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain distinct from I. Example Domain-distinct-monotonicity Example complement of transitive-closure TC(x, y) E(x, y) M distinct Complement of the transitive TC(x, closure y) of E(x, a z),tc(z,y) graph is not domain-distinct-monotone. O(x, y) TC(x, y),x6= y } stratified Datalog stratum 1 2 } stratum 2 c a b a b I [ J Q(I [ J) Avoiding coordination CALM-theorems PODS June 29, 2016 50 / 62

Weaker forms of monotonicity Definition A query Q is domain-distinct-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain distinct from I. Observation (preserved under extensions) When Q is domain-distinct-monotone, then for all subsets of the domain C. Q(I C ) Q(I ) Induced subinstance: I C = {f I adom(f) C} Avoiding coordination CALM-theorems PODS June 29, 2016 50 / 62

CALM-Theorem (1) Theorem (Ameloot, Ketsman, N., Zinn, PODS 2014) The following are equivalent. Query Q is 1 computable by a coordination-free relational transducer network that has access to the initial distribution; 2 domain-distinct-monotone. Avoiding coordination CALM-theorems PODS June 29, 2016 51 / 62

CALM-Theorem (1) Theorem (Ameloot, Ketsman, N., Zinn, PODS 2014) The following are equivalent. Query Q is 1 computable by a coordination-free relational transducer network that has access to the initial distribution; 2 domain-distinct-monotone. Crux (2) (1): (very rough) every transducer has access to the initial distribution: broadcast both occurring and missing facts transducer outputs Q(J C ) for every set C on which they have complete knowledge Avoiding coordination CALM-theorems PODS June 29, 2016 51 / 62

CALM-Theorem (1) Theorem (Ameloot, Ketsman, N., Zinn, PODS 2014) The following are equivalent. Query Q is 1 computable by a coordination-free relational transducer network that has access to the initial distribution; 2 domain-distinct-monotone. Corollary: Every language defining all domain-disjoint-monotone queries is a complete language for coordination-free computation Semi-positive datalog with value invention [Cabibbo, 1998] Avoiding coordination CALM-theorems PODS June 29, 2016 51 / 62

Even weaker forms of monotonicity Definition A query Q is domain-disjoint-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain disjoint from I. Avoiding coordination CALM-theorems PODS June 29, 2016 52 / 62

Even weaker forms of monotonicity Definition A query Q is domain-disjoint-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain disjoint from I. Example Domain-distinct-monotonicity Example complement of transitive-closure TC(x, y) E(x, y) TC(x, y) E(x, z),tc(z,y) O(x, y) TC(x, y),x6= y Complement of the transitive closure of a graph is domain-disjoint-monotone. 2 M distinct stratified Datalog stratum 1 } } stratum 2 a b a b I Q(I) Avoiding coordination CALM-theorems PODS June 29, 2016 52 / 62

Even weaker forms of monotonicity Definition A query Q is domain-disjoint-monotone if Q(I ) Q(I J) for all instances I and J for which J is domain disjoint from I. Observation (preserved under disjoint extension) When Q is domain-disjoint-monotone, then Q(C) Q(I ) for all instances I and connected components C of I. Avoiding coordination CALM-theorems PODS June 29, 2016 52 / 62

CALM-Theorem (2) Theorem (Ameloot, Ketsman, N., Zinn, PODS 2014) The following are equivalent. Query Q is 1 computable by a coordination-free relational transducer network under domain-guided distribution policies; and, 2 domain-disjoint-monotone. Avoiding coordination CALM-theorems PODS June 29, 2016 53 / 62

CALM-Theorem (2) Theorem (Ameloot, Ketsman, N., Zinn, PODS 2014) The following are equivalent. Query Q is 1 computable by a coordination-free relational transducer network under domain-guided distribution policies; and, 2 domain-disjoint-monotone. Corollary: Every language defining all domain-disjoint-monotone queries is a complete language for coordination-free computation Semi-connected Datalog with value invention [Ameloot, Ketsman, N., Zinn, PODS 2014] Avoiding coordination CALM-theorems PODS June 29, 2016 53 / 62

Definition Connected Datalog rule For a Datalog rule ', graph + (') is the graph where nodes Definition are the variables of ', and there is an edge between two variables if they occur together in a positive body atom of '. A Datalog rule is connected when the graph formed by the positive atoms is connected. ' is connected if graph + (') is connected. Example Example ' O(x, y, z) E(x, y),e(y, z),e(z,x) is connected x y z graph + (') Avoiding coordination CALM-theorems PODS June 29, 2016 54 / 62

Connected Datalog rule Example Example x z O(x, y, z) E(x, y),e(z,u) is not connected y u O(x, y,z) E(x, y), E(y,z) is not connected x z y Avoiding coordination CALM-theorems PODS June 29, 2016 55 / 62

Semi-connected Definition Datalog A Datalog program is semi-connected if all ru Definition connected except (possibly) those of the last str A Datalog program is semi-connected if all rules are connected except (possibly) those of the last stratum. Example Example TC(x, y) E(x, y) TC(x, y) E(x, z),tc(z,y) O(x, y) TC(x, y),x6= y Observation Semi-positive Datalog is strictly included in semi-connected Datalog Semi-connected Datalog defines only domain-distinct-monotone SP-Datalog semi-connected Datalog queries Avoiding coordination CALM-theorems PODS June 29, 2016 56 / 62

Connected Datalog Win-move: win(x) move(x, y), win(y) Avoiding coordination CALM-theorems PODS June 29, 2016 57 / 62

Connected Datalog Win-move: win(x) move(x, y), win(y) Theorem (Zinn, Green, Ludäscher, ICDT 2012) The query computing the won positions of the win-move game is in F 2 Avoiding coordination CALM-theorems PODS June 29, 2016 57 / 62

Connected Datalog Win-move: win(x) move(x, y), win(y) Theorem (Zinn, Green, Ludäscher, ICDT 2012) The query computing the won positions of the win-move game is in F 2 Proof. Simulation in semi-monotone fragment of Datalog disorderly semantics [Abiteboul, Vianu, 1991]. with a novel Avoiding coordination CALM-theorems PODS June 29, 2016 57 / 62

Connected Datalog Win-move: win(x) move(x, y), win(y) Theorem (Zinn, Green, Ludäscher, ICDT 2012) The query computing the won positions of the win-move game is in F 2 Proof. Simulation in semi-monotone fragment of Datalog disorderly semantics [Abiteboul, Vianu, 1991]. with a novel Theorem (Ameloot, Ketsman, N., Zinn, ICDT 2015) Queries expressed in connected Datalog under the well-founded semantics are in F 2. Avoiding coordination CALM-theorems PODS June 29, 2016 57 / 62

CALM overview Extended CALM-theorem Datalog(6=) ( wilog(6=) = M = F 0 = A 0 ( ( ( ( ( SP-Datalog ( SP-wILOG = M distinct = F 1 = A 1 ( ( ( ( ( semicon-datalog ( semicon-wilog = M disjoint = F 2 = A 2 Avoiding coordination CALM-theorems PODS June 29, 2016 58 / 62

Intermediate wrap-up Summary: CALM-theorems link Datalog, monotonicity, and coordination-freeness on different levels Connected Datalog Avoiding coordination CALM-theorems PODS June 29, 2016 59 / 62

Intermediate wrap-up Summary: CALM-theorems link Datalog, monotonicity, and coordination-freeness on different levels Connected Datalog Research issues: Broadcast algorithms are not efficient (initial steps in [Ketsman, N., ICDT 2015]) Quantify coordination [Alvaro et al., CIDR 2011, ICDE 2014] General theory of asynchronous query evaluation to capture efficient evaluation Avoiding coordination CALM-theorems PODS June 29, 2016 59 / 62

Outline 1 Introduction 2 Complexity of parallel query processing 3 Reasoning about data partitioning 4 Avoiding coordination 5 Discussion Discussion PODS June 29, 2016 60 / 62

Discussion Overview MPC & Shares/HyperCube Parallel-correctness and transferability Coordination-freeness and degrees of monotonicity Fascinating research area: exciting new machinery e.g., optimal fractional node/edge coverings old wine in new bottles e.g., decision problems relating to CQs e.g., Datalog and monotonicity Discussion PODS June 29, 2016 61 / 62