C-Store: Tuple Reconstruction Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Mar 27, 2009.

Slides:



Advertisements
Similar presentations
An Array-Based Algorithm for Simultaneous Multidimensional Aggregates By Yihong Zhao, Prasad M. Desphande and Jeffrey F. Naughton Presented by Kia Hall.
Advertisements

C-Store: Self-Organizing Tuple Reconstruction Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Apr. 17, 2009.
CS 540 Database Management Systems
EXECUTION PLANS By Nimesh Shah, Amit Bhawnani. Outline  What is execution plan  How are execution plans created  How to get an execution plan  Graphical.
CS 245Notes 31 (1) Insertion/Deletion (2) Buffer Management (3) Comparison of Schemes Other Topics.
C-Store: Class Overview Spring, 2009 Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Feb 27, 2009.
Implementation of Other Relational Algebra Operators, R. Ramakrishnan and J. Gehrke1 Implementation of other Relational Algebra Operators Chapter 12.
C-Store: Updates Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May. 15, 2009.
Query Evaluation. An SQL query and its RA equiv. Employees (sin INT, ename VARCHAR(20), rating INT, age REAL) Maintenances (sin INT, planeId INT, day.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 52 Database Systems I Relational Algebra.
1 Chapter 10 Query Processing: The Basics. 2 External Sorting Sorting is used in implementing many relational operations Problem: –Relations are typically.
ACS-4902 Ron McFadyen Chapter 15 Algorithms for Query Processing and Optimization.
Query Execution Professor: Dr T.Y. Lin Prepared by, Mudra Patel Class id: 113.
1 Evaluation of Relational Operations: Other Techniques Chapter 12, Part B.
CSCI 5708: Query Processing I Pusheng Zhang University of Minnesota Feb 3, 2004.
1 Query Processing: The Basics Chapter Topics How does DBMS compute the result of a SQL queries? The most often executed operations: –Sort –Projection,
Chapter 19 Query Processing and Optimization
Lecture 6 Indexing Part 2 Column Stores. Indexes Recap Heap FileBitmapHash FileB+Tree InsertO(1) O( log B n ) DeleteO(P)O(1) O( log B n ) Range Scan O(P)--
1 Relational Operators. 2 Outline Logical/physical operators Cost parameters and sorting One-pass algorithms Nested-loop joins Two-pass algorithms.
Introduction to Column-Oriented Databases Seminar: Columnar Databases, Nov 2012, Univ. Helsinki.
C-Store: Column Stores over Solid State Drives Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Jun 19, 2009.
NiagaraCQ A Scalable Continuous Query System for Internet Databases Jianjun Chen, David J DeWitt, Feng Tian, Yuan Wang University of Wisconsin – Madison.
CS 345: Topics in Data Warehousing Tuesday, October 19, 2004.
C-Store: Column-Oriented Data Warehousing Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May 17, 2010.
DANIEL J. ABADI, ADAM MARCUS, SAMUEL R. MADDEN, AND KATE HOLLENBACH THE VLDB JOURNAL. SW-Store: a vertically partitioned DBMS for Semantic Web data.
Ashwani Roy Understanding Graphical Execution Plans Level 200.
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Chapter 13 Query Processing Melissa Jamili CS 157B November 11, 2004.
CPSC 404, Laks V.S. Lakshmanan1 Evaluation of Relational Operations: Other Operations Chapter 14 Ramakrishnan & Gehrke (Sections ; )
Daniel J. Abadi · Adam Marcus · Samuel R. Madden ·Kate Hollenbach Presenter: Vishnu Prathish Date: Oct 1 st 2013 CS 848 – Information Integration on the.
C-Store: How Different are Column-Stores and Row-Stores? Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May. 8, 2009.
C-Store: Concurrency Control and Recovery Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Jun. 5, 2009.
Query Execution Section 15.1 Shweta Athalye CS257: Database Systems ID: 118 Section 1.
C-Store: Data Model and Data Organization Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May 17, 2010.
EECS 262a Advanced Topics in Computer Systems Lecture 16 C-Store / DB Cracking October 22 nd, 2012 John Kubiatowicz and Anthony D. Joseph Electrical Engineering.
C-Store: Integrating Compression and Execution Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Mar 20, 2009.
Chapter 12 Query Processing (1) Yonsei University 2 nd Semester, 2013 Sanghyun Park.
C-Store: RDF Data Management Using Column Stores Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Apr. 24, 2009.
CS411 Database Systems Kazuhiro Minami 11: Query Execution.
Marwan Al-Namari Hassan Al-Mathami. Indexing What is Indexing? Indexing is a mechanisms. Why we need to use Indexing? We used indexing to speed up access.
EECS 262a Advanced Topics in Computer Systems Lecture 16 C-Store / DB Cracking October 28 th, 2013 John Kubiatowicz and Anthony D. Joseph Electrical Engineering.
Multi pass algorithms. Nested-Loop joins Tuple-Based Nested-loop Join Algorithm: FOR each tuple s in S DO FOR each tuple r in R DO IF r and s join to.
Advance Database Systems Query Optimization Ch 15 Department of Computer Science The University of Lahore.
Query Execution. Where are we? File organizations: sorted, hashed, heaps. Indexes: hash index, B+-tree Indexes can be clustered or not. Data can be stored.
MapReduce and the New Software Stack. Outline  Algorithm Using MapReduce  Matrix-Vector Multiplication  Matrix-Vector Multiplication by MapReduce 
More Optimization Exercises. Block Nested Loops Join Suppose there are B buffer pages Cost: M + ceil (M/(B-2))*N where –M is the number of pages of R.
File Processing : Query Processing 2008, Spring Pusan National University Ki-Joune Li.
Query Execution Query compiler Execution engine Index/record mgr. Buffer manager Storage manager storage User/ Application Query update Query execution.
Alon Levy 1 Relational Operations v We will consider how to implement: – Selection ( ) Selects a subset of rows from relation. – Projection ( ) Deletes.
Chapter 10 The Basics of Query Processing. Copyright © 2005 Pearson Addison-Wesley. All rights reserved External Sorting Sorting is used in implementing.
Module 11: File Structure
Indexes By Adrienne Watt.
Database Management System
Chapter 12: Query Processing
Chapter 15 QUERY EXECUTION.
Database Management Systems (CS 564)
Join Processing in Database Systems with Large Main Memories (part 2)
File Processing : Query Processing
Relational Operations
Database Applications (15-415) DBMS Internals- Part VI Lecture 15, Oct 23, 2016 Mohammad Hammoud.
Database Applications (15-415) DBMS Internals- Part IX Lecture 21, April 1, 2018 Mohammad Hammoud.
Column-Stores vs. Row-Stores: How Different Are They Really?
Advance Database Systems
Chapter 12 Query Processing (1)
Lecture 13: Query Execution
Evaluation of Relational Operations: Other Techniques
External Sorting Sorting is used in implementing many relational operations Problem: Relations are typically large, do not fit in main memory So cannot.
Yan Huang - CSCI5330 Database Implementation – Query Processing
John Kubiatowicz Electrical Engineering and Computer Sciences
Unit 12 Index in Database 大量資料存取方法之研究 Approaches to Access/Store Large Data 楊維邦 博士 國立東華大學 資訊管理系教授.
Presentation transcript:

C-Store: Tuple Reconstruction Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Mar 27, 2009

Motivation In a Column-Oriented DBMS, columns are stored separately Separate column values of the same logical tuple must be stitched together when the tuple is finally returned to a user.

How to Identify Column Values of the Same Logical Tuple? Attach either physical or virtual tuple ID or positions to column values.  In the Read Store of C-Store, a Storage Key is equal to a position in a column.  In the Write Store of C-Store, a Storage Key is physically stored as a tuple ID. Tuple Reconstruction is easy if columns are sorted in the same order  Join on the positions instead of on the physical tuple ID.

Two Strategies of Tuple Reconstruction Early Materialization (EM)  Whenever a column C1 is accessed, add C1 (concrete column values) to an intermediate tuple representation if C1 is needed by some later operator, or if C1 is one of the output columns. Late Materialization (LM)  Construct tuples as late as possible.

Tuple Reconstruction: An Example (1) Assume a relation R has 3 columns  R.a, R.b, R.c  All the 3 columns are sorted in the same order,  and are stored in separate files. Suppose a query consists of 3 selection predicates  σ 1, σ 2, σ 3 over R.a, R.b, R.c respectively  σ 1 is the most selective predicate  σ 3 is the least selective predicate

Tuple Reconstruction : An Example (2) An early materialization strategy could process the query as follows:  Read in a block of R.a, a block of R.b, and a block of R.c from disk.  Stitch them together into block(s) of triples (R.a, R.b, R.c ).  Apply σ 1, σ 2, σ 3 in turn, allowing tuples that match the predicates to pass through.

Tuple Reconstruction : An Example (3) A late materialization strategy could process the query as follows:  First scan R.a, and output the positions in R.a that satisfy σ 1.  Second scan R.b, and output the positions in R.b that satisfy σ 2.  Third scan R.c, and output the positions in R.c that satisfy σ 3.  Fourth use position-wise AND to find the intersection of the 3 position lists.  Finally re-scan R.a, R.b, and R.c, and extract the values of the records whose positions are in the intersection, and stitch these values together into output tuples.

Late Materialization: Potential Pros and Cons + Operating directly on position lists + Constructing only relevant tuples. - re-scanning the base columns to form tuples.

Early Materialization Advantages No need to re-scan a column. If the re-scanning cost at tuple reconstruction time is high, early materialization gets bonus.

An Analytical Model for Comparing the Two Materialization Strategies The model is composed of 3 types of operators:  Data Source (DS) operator  AND operator  Tuple Construction operator  These operators are enough for expressing simple queries using each materialization strategy.

Data Source (DS) operator: Case 1 Input  A column C i of | C i | blocks from disk.  A predicate with selectivity SF. Ouput  A column of positions of the tuples that satisfy the predicate. Used by late materialization.

Data Source (DS) operator: Case 2 Input  A column C i of | C i | blocks from disk.  A predicate with selectivity SF. Ouput  A column of (position, value) pairs of the tuples that satisfy the predicate. Used by early materialization.

Data Source (DS) operator: Case 3 Input  A column C i of | C i | blocks from disk or memory.  A list of positions, i.e., POSLIST. Ouput  A column of the values corresponding to the positions in POSLIST. Used by late materialization.

Data Source (DS) operator: Case 4 Input  A column C i of | C i | blocks from disk.  A predicate with selectivity SF.  A set of intermediate tuples of the form (pos, ). Ouput  A set of intermediate tuples of the new form (pos, <a 1,..., a n,, a n+1 ), i,e., adding column C i to tuples. Used by early materialization.

The AND Operator Input:  k position lists, inpos 1,...,inpos k. Output:  outpos: a new list of positions representing the inetersection of those input lists. Operating on positions is fast.

Tuple Construction Operators The MERGE operator  input: k sets of values VAL 1,...,VAL k.  output:a set of k-ary tuples.  This operator is used to construct tuples at the top of a late materialization plan. The SPC(Scan, Predicate, and Construct) operator  input: k columns VAL 1,...,VAL k from disk; a set of predicates.  output:a set of tuples that pass all predicates.  This operator can sit at the bottom of an early materialization plan.

Example Query Plans: EM

Example Query Plans: LM

Optimization in Late Materialization Data Source Case 3: produce values from positions  Input A column C i of | C i | blocks from disk or memory. A list of positions, i.e., POSLIST.  Ouput A column of the values corresponding to the positions in POSLIST. Optimization  If the column is in memory, do not read it from disk.  i.e., reduce the cost of re-scanning a column.

LM Optimization: Multi-Columns A Multi-Column is a specialized data structure  allows blocks of column data to remain in memory after the first scan so that those blocks can be easily scanned again later on.  Contains a memory-resident, horizontal partition of some subset of columns from a logical relation.

Components of a Multi-Column A covering position range:  Indicates the virtual start position and end position of the horizontal partition An array of mini-columns:  A mini-column is the set of corresponding values for a specified position range of a column.  Each mini-column is kept compressed the same way as it was on disk. A position descriptor:  Indicates which positions in the position range remain valid.

Construction of a Multi-Column Initially a multi-column contains only one mini- column.  When a page of a column is read from disk, a mini-column is created with a position descriptor indicating that all positions are valid.  Each mini-column can be just a pointer to the page in the buffer. A modified AND operator is used to merge two multi-columns into a wider multi-column.

The Use of a Multi-Column If a DS Case 3 operator takes as input a multi-column rather than just a position list,  then it has no need to re-scan the column (from disk).

Predicated vs. Actual Behavior

Heuristic for Choosing Materialization Strategy Use Late Materialization  If a query contains aggregation,  or if the selectivity of predicates in the query is small. Use Early Materialization  in contrast to the conditions for late materialization.

References Mike Stonebraker, Daniel Abadi, Adam Batkin, Xuedong Chen, Mitch Cherniack, Miguel Ferreira, Edmond Lau, Amerson Lin, Sam Madden, Elizabeth O'Neil, Pat O'Neil, Alex Rasin, Nga Tran and Stan Zdonik. C-Store: A Column Oriented DBMS, VLDB, Daniel J. Abadi, Daniel S. Myers, David J. DeWitt, and Samuel R. Madden 。 Materialization Strategies in a Column-Oriented DBMS. Proceedings of ICDE, April, 2007, Istanbul, Turkey.