John Kubiatowicz Electrical Engineering and Computer Sciences

Slides:



Advertisements
Similar presentations
C-Store: Self-Organizing Tuple Reconstruction Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Apr. 17, 2009.
Advertisements

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.
C-Store: Updates Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May. 15, 2009.
Introduction to Column-Oriented Databases Seminar: Columnar Databases, Nov 2012, Univ. Helsinki.
Cloud Computing Lecture Column Store – alternative organization for big relational data.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
1 C-Store: A Column-oriented DBMS New England Database Group (Stonebraker, et al. Brandeis/Brown/MIT/UMass-Boston) Extended for Big Data Reading Group.
© Stavros Harizopoulos 2006 Performance Tradeoffs in Read-Optimized Databases Stavros Harizopoulos MIT CSAIL joint work with: Velen Liang, Daniel Abadi,
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
C-Store: Column-Oriented Data Warehousing Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May 17, 2010.
Performance Tradeoffs in Read-Optimized Databases Stavros Harizopoulos * MIT CSAIL joint work with: Velen Liang, Daniel Abadi, and Sam Madden massachusetts.
© Stavros Harizopoulos 2006 Performance Tradeoffs in Read- Optimized Databases: from a Data Layout Perspective Stavros Harizopoulos MIT CSAIL Modified.
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
1 C-Store: A Column-oriented DBMS By New England Database Group.
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.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
C-Store: Tuple Reconstruction Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY Mar 27, 2009.
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.
File Structures. 2 Chapter - Objectives Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and.
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.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
M.Kersten MonetDB, Cracking and recycling Martin Kersten CWI Amsterdam.
Chapter 5 Record Storage and Primary File Organizations
Database cracking Stratos Idreos, Martin Kersten and Stefan Manegold
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
CS 540 Database Management Systems
Module 11: File Structure
CPS216: Data-intensive Computing Systems
CS 540 Database Management Systems
Indexing Structures for Files and Physical Database Design
CHP - 9 File Structures.
CS 540 Database Management Systems
CS 440 Database Management Systems
CS422 Principles of Database Systems Course Overview
CS522 Advanced database Systems
Lecture 16: Data Storage Wednesday, November 6, 2006.
Storage and Indexes Chapter 8 & 9
Physical Database Design and Performance
Database Performance Tuning &
Database Management Systems (CS 564)
Hash-Based Indexes Chapter 11
Database Performance Tuning and Query Optimization
Introduction to Query Optimization
Lecture 10: Buffer Manager and File Organization
MANAGING DATA RESOURCES
Physical Database Design
External Sorting The slides for this text are organized into chapters. This lecture covers Chapter 11. Chapter 1: Introduction to Database Systems Chapter.
Hash-Based Indexes Chapter 10
Introduction to Database Systems
Selected Topics: External Sorting, Join Algorithms, …
Relational Algebra Chapter 4, Sections 4.1 – 4.2
MANAGING DATA RESOURCES
The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited)
Column-Stores vs. Row-Stores: How Different Are They Really?
Chapter 13: Data Storage Structures
H-store: A high-performance, distributed main memory transaction processing system Robert Kallman, Hideaki Kimura, Jonathan Natkins, Andrew Pavlo, Alex.
CSTORE E0261 Jayant Haritsa Computer Science and Automation
Chapter 11 Database Performance Tuning and Query Optimization
ICOM 5016 – Introduction to Database Systems
Self-organizing Tuple Reconstruction in Column-stores
Chapter 3 Database Management
Chapter 11 Instructor: Xin Zhang
Chapter 13: Data Storage Structures
Chapter 13: Data Storage Structures
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Lecture 20: Representing Data Elements
Presentation transcript:

EECS 262a Advanced Topics in Computer Systems Lecture 22 C-Store / DB Cracking November 8th, 2018 John Kubiatowicz Electrical Engineering and Computer Sciences University of California, Berkeley http://www.eecs.berkeley.edu/~kubitron/cs262 CS252 S05

Today’s Papers Thoughts? C-Store: A Column-oriented DBMS* Mike Stonebraker, Daniel J. 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, Stan Zdonik. Appears in Proceedings of the ACM Conference on Very Large Databases(VLDB), 2005 Database Cracking+ Stratos Idreos, Martin L. Kersten, and Stefan Manegold. Appears in the 3rd Biennial Conference on Innovative Data Systems Research (CIDR), January 7-10, 2007 Wednesday: Comparison of PDBMS, CS, MR Thoughts? *Some slides based on slides from Jianlin Feng, School of Software, Sun Yat-Sen University +Some slides based on slides from Stratos Idreos, CWI Amsterdam, The Netherlands

Relational Data: Logical View Name Age Department Salary Bob 25 Math 10K Bill 27 EECS 50K Jill 24 Biology 80K

C-Store: A Column-oriented DBMS Physical layout: Row store or Column store Column 1 Column 2 Column 3 Record 1 Record 2 Record 3 Relation or Tables

Row Stores On-Line Transaction Processing (OLTP) ATM, POS in supermarkets Characteristics of OLTP applications: Transactions that involve small numbers of records (or tuples) Frequent updates (including queries) Many users Fast response times OLTP needs a write-optimized row store Insert and delete a record in one physical write Easy to add new record, but might read unnecessary data (wasted memory and I/O bandwidth)

Row Store: Columns Stored Together Data Rid = (i,N) Page i Rid = (i,2) Rid = (i,1) 20 16 24 N Pointer to start of free space N . . . 2 1 Slot Array # slots SLOT DIRECTORY Record id = <page id, slot #>

Current DBMS Gold Standard Store columns from one record contiguously on disk Use B-tree indexing Use small (e.g. 4K) disk blocks Align fields on byte or word boundaries Conventional (row-oriented) query optimizer and executor (technology from 1979) Aries-style transactions

OLAP and Data Warehouses On-Line Analytical Processing (OLAP) Flexible reporting for Business Intelligence Characteristics of OLAP applications Transactions that involve large numbers of records Frequent Ad-hoc queries and infrequent updates A few decision-making users Fast response times Data Warehouses facilitate reporting and analysis Read-Mostly Other read-mostly applications Customer Relationship Management (Siebel, Oracle) Catalog Search in E-Commerce (Amazon.com, Bestbuy.com)

Column Stores Logical data model: Relational Model Key Intuition: Only read relevant columns Example: Ad-hoc queries read 2 columns out of 20 Multiple prior column store implementations Sybase IQ (early ’90s, bitmap index) Addamark (i.e., SenSage, for Event Log data warehouse) KDB (Column-stores for financial services companies) MonetDB (Hyper-Pipelining Query Execution, CIDR’05) Only read necessary data, but might need multiple seeks

Read-Optimized Databases 1 SQL Server DB2 Oracle 1 Joe 45 … … … 2 Sue 37 Sybase IQ MonetDB KDB C-Store 2 Joe … Sue 45 … 37 … row stores column stores Effect of column-orientation on performance? Read-less, seek more so depends on prefetching, query selectivity, tuple width, competing query traffic

row stores column stores Rows versus Columns row stores column stores reconstruct Joe 45 project Joe 45 Joe 45 1 2 … Joe Sue 45 37 3 files seek 1 Joe 45 2 Sue 37 single file … … …

C-Store Technical Ideas Column Store with some “novel” ideas (below) Only materialized views on each relation (perhaps many) Active data compression Column-oriented query executor and optimizer Shared-nothing architecture Replication-based concurrency control and recovery Writeable Store (WS) Tuple Mover Read-optimized Store (RS) Read-optimized Store (RS) Read-optimized Store (RS) Read-optimized Store (RS)

Architecture of Vertica C-Store

Basic Concepts A logical table is physically represented as a set of projections Each projection consists of a set of columns Columns are stored separately, along with a common sort order defined by SORT KEY Each column appears in at least one projection A column can have different sort orders if it is stored in multiple projections

Example C-Store Projection LINEITEM(shipdate, quantity, retflag, suppkey | shipdate, quantity, retflag) First sorted by shipdate Second sorted by quantity Third sorted by retflag Sorting increases locality of data Favors compression techniques such as Run-Length Encoding (see Elephant paper)

C-Store Operators Selection Mask Permute Projection Join Produce bitmaps that can be efficiently combined Mask Materialize a set of values from a column and a bitmap Permute Reorder a column using a join index Projection Free operation! Two columns in the same order can be concatenated for free Join Produces positions rather than values

Example: Join over Two Columns

Column Store has High Compressibility Each attribute is stored in a separate column Related values are compressible (versus values of separate attributes) Compression benefits Reduces the data sizes Improves disk (and memory) I/O performance by: reducing seek times (related data stored nearer together) reducing transfer times (less data to read/write) increasing buffer hit rate (buffer can hold larger fraction of data)

Compression Methods Dictionary Bit-pack Delta Pack several attributes inside a 4-byte word Use as many bits as max-value Delta Base value per page Arithmetic differences No Run-Length Encoding (unlike Elephant paper) … ‘low’ … … ‘high’ … … ‘normal’ … … 00 … … 10 … … 01 …

C-Store Use of Snapshot Isolation Snapshot Isolation for Fast OLAP/Data Warehousing Allows very fast transactions without locks Can read large consistent snapshot of database Divide into RS and WS stores Read Store is Optimized for Fast Read-Only Transactions Write Store is Optimized for Transactional Updates Low Water Mark (LWM) Represents earliest epoch at which read-only transactions can run RS contains tuples added before LWM High Water Mark (HWM) Represents latest epoch at which read-only transactions can run

Other Ideas K-safety: Can handle up to K-1 failures Join Tables Every piece of data replicated K times Different projections sorted in different ways Join Tables Construct original tuples given covering projects Vertica gave up on Join Tables – too expensive, require super-projections

Evaluation? Series of 7 queries against C-Store vs two commercial DBMS C-Store faster In all cases, sometimes significantly Why so much faster? Column Representation – avoid extra reads Overlapping projections – multiple orderings of column as appropriate Better data compression Query operators operating on compressed data

Summary Columns outperform rows in listed workloads Reasons: Column representation avoids reads of unused attributes Query operators operate on compressed representation, mitigating storage barrier problem Avoids memory-bandwidth bottleneck in rows Storing overlapping projections, rather than the whole table allows storage of multiple orderings of a column as appropriate Better compression of data allows more orderings in the same space Results from other papers: Prefetching is key to columns outperforming rows Systems with competing traffic favor columns

Is this a good paper? What were the authors’ goals? What about the evaluation/metrics? Did they convince you that this was a good system/approach? Were there any red-flags? What mistakes did they make? Does the system/approach meet the “Test of Time” challenge? How would you review this paper today?

BREAK

DB Physical Organization Problem Many DBMS perform well and efficiently only after being tuned by a DBA DBA decides: Which indexes to build? On which data parts? and when to build them?

Timeline Very complex and time consuming process! Sample workload Analyze performance Prepare estimated physical design Queries Very complex and time consuming process! What about: Dynamic, changing workloads? Very Large Databases?

Database Cracking Solve challenges of dynamic environments: How? Remove all tuning and physical design steps, but still get similar performance as a fully tuned system How? Design new auto-tuning kernels DBA with cracking (operators, plans, structures, etc.)

Database Cracking No monitoring No preparation No external tools No full indexes No human involvement Continuous on-the-fly physical reorganization Partial, incremental, adaptive indexing Designed for modern column-stores

Cracking Example Each query is treated as an advice on how data should be stored Triggers physical re-organization of the database Column A 13 16 4 9 2 12 7 1 19 3 14 11 8 6 Q1: select * from R where R.A > 10 and R.A < 14

Cracking Design The first time a range query is posed on an attribute A, a cracking DBMS makes a copy of column A, called the cracker column of A A cracker column is continuously physically re-organized based on queries that need to touch attribute such as the result is in a contiguous space For each cracker column, there is a cracker index

Cracking Algorithms Two types of cracking algorithms based on select’s where clause where X < # where # < X < # Split a piece into Split a piece into two new pieces three new pieces

Cracker Select Operator Traditional select operator Scans the column Returns a new column that contains the qualifying values The cracker select operator Searches the cracker index Physically re-organizes the pieces found Updates the cracker index Returns a slice of the cracker column as the result More steps but faster because analyzes less data

Cracking Example Each query is treated as advice on how data should be stored Physically reorganize based on the selection predicate Cracker Column A 4 9 2 7 1 3 8 6 13 12 11 16 19 14 Column A 13 16 4 9 2 12 7 1 19 3 14 11 8 6 Piece 1: A ≤ 10 Q1: select * from R where R.A > 10 and R.A < 14 Piece 2: 10 < A < 14 Piece 3: 14 ≤ A

Cracking Example Each query is treated as advice on how data should be stored Physically reorganize based on the selection predicate Cracker Column A 4 9 2 7 1 3 8 6 13 12 11 16 19 14 Column A 13 16 4 9 2 12 7 1 19 3 14 11 8 6 Piece 1: A ≤ 10 Q1: select * from R where R.A > 10 and R.A < 14 Piece 2: 10 < A < 14 Piece 3: 14 ≤ A

Cracking Example Improve data access for future queries Each query is treated as advice on how data should be stored Physically reorganize based on the selection predicate Cracker Column A 4 9 2 7 1 3 8 6 13 12 11 16 19 14 Column A 13 16 4 9 2 12 7 1 19 3 14 11 8 6 Piece 1: A ≤ 10 Gain knowledge on how to organize data on-the-fly within the select-operator Q1: select * from R where R.A > 10 and R.A < 14 Result tuples Piece 2: 10 < A < 14 Piece 3: 14 ≤ A

Cracking Example Each query is treated as advice on how data should be stored Physically reorganize based on the selection predicate Cracker Column A 4 9 2 7 1 3 8 6 13 12 11 16 19 14 Column A 13 16 4 9 2 12 7 1 19 3 14 11 8 6 Q1: select * from R where R.A > 10 and R.A < 14 Piece 1: A ≤ 10 Q1 Q2: select * from R where R.A > 7 and R.A ≤16 Piece 2: 10 < A < 14 Piece 3: 14 ≤ A

Cracking Example Each query is treated as advice on how data should be stored Physically reorganize based on the selection predicate Cracker Column A 4 9 2 7 1 3 8 6 13 12 11 16 19 14 Cracker Column A 4 2 1 3 6 7 9 8 13 12 11 14 16 19 Column A 13 16 4 9 2 12 7 1 19 3 14 11 8 6 Q1: select * from R where R.A > 10 and R.A < 14 Piece 1: A ≤ 10 Piece 1: A ≤ 7 Q1 Q2 Piece 2: 7 < A ≤10 Q2: select * from R where R.A > 7 and R.A ≤16 Piece 2: 10 < A < 14 Piece 3: 10<A<14 Piece 4: 14≤A≤16 Piece 3: 14 ≤ A Piece 5: 16 < A

Cracking Example Each query is treated as advice on how data should be stored Physically reorganize based on the selection predicate Cracker Column A 4 9 2 7 1 3 8 6 13 12 11 16 19 14 Cracker Column A 4 2 1 3 6 7 9 8 13 12 11 14 16 19 Column A 13 16 4 9 2 12 7 1 19 3 14 11 8 6 Q1: select * from R where R.A > 10 and R.A < 14 Piece 1: A ≤ 10 Piece 1: A ≤ 7 Q1 Q2 Piece 2: 7 < A ≤10 Q2: select * from R where R.A > 7 and R.A ≤16 Piece 2: 10 < A < 14 Piece 3: 10<A<14 Piece 4: 14≤A≤16 Piece 3: 14 ≤ A Piece 5: 16 < A

Cracking Example The more cracking, the more learned Each query is treated as advice on how data should be stored Physically reorganize based on the selection predicate Cracker Column A 4 9 2 7 1 3 8 6 13 12 11 16 19 14 Cracker Column A 4 2 1 3 6 7 9 8 13 12 11 14 16 19 Column A 13 16 4 9 2 12 7 1 19 3 14 11 8 6 Q1: select * from R where R.A > 10 and R.A < 14 Result tuples Piece 1: A ≤ 10 Piece 1: A ≤ 7 Q1 Q2 Piece 2: 7 < A ≤10 Q2: select * from R where R.A > 7 and R.A ≤16 Piece 2: 10 < A < 14 Piece 3: 10<A<14 Piece 4: 14≤A≤16 Piece 3: 14 ≤ A Piece 5: 16 < A

Self-Organizing Behavior (Count(*) range query)

Self-Organizing Behavior (TPC-H Query 6) TPC-H is an ad-hoc, decision support benchmark Business oriented ad-hoc queries, concurrent data modifications Example: Tell me the amount of revenue increase that would have resulted from eliminating certain company-wide discounts in a given percentage range in a given year Workload: Database load Execution of 22 read-only queries in both single and multi-user mode Execution of 2 refresh functions

Is this a good paper? What were the authors’ goals? What about the evaluation/metrics? Did they convince you that this was a good system/approach? Were there any red-flags? What mistakes did they make? Does the system/approach meet the “Test of Time” challenge? How would you review this paper today?