CSTORE E0261 Jayant Haritsa Computer Science and Automation

Slides:



Advertisements
Similar presentations
Physical Database Design and Tuning R&G - Chapter 20 Although the whole of this life were said to be nothing but a dream and the physical world nothing.
Advertisements

Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Transaction.
C-Store: Updates Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May. 15, 2009.
Distributed Databases
Cloud Computing Lecture Column Store – alternative organization for big relational data.
C-Store: A Column-oriented DBMS Speaker: Zhu Xinjie Supervisor: Ben Kao.
Practical Database Design and Tuning. Outline  Practical Database Design and Tuning Physical Database Design in Relational Databases An Overview of Database.
1 © Prentice Hall, 2002 Physical Database Design Dr. Bijoy Bordoloi.
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.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 12 Distributed Database Management Systems.
Daniel J. Abadi · Adam Marcus · Samuel R. Madden ·Kate Hollenbach Presenter: Vishnu Prathish Date: Oct 1 st 2013 CS 848 – Information Integration on the.
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.
Storage and Indexing1 Overview of Storage and Indexing.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
C-Store: Data Model and Data Organization Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May 17, 2010.
Chapter 9 Database Systems © 2007 Pearson Addison-Wesley. All rights reserved.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
7 Strategies for Extracting, Transforming, and Loading.
Chapter 4 Logical & Physical Database Design
3/6: Data Management, pt. 2 Refresh your memory Relational Data Model
 Distributed Database Concepts  Parallel Vs Distributed Technology  Advantages  Additional Functions  Distribution Database Design  Data Fragmentation.
Column Oriented Database By: Deepak Sood Garima Chhikara Neha Rani Vijayita Gumber.
Oracle Announced New In- Memory Database G1 Emre Eftelioglu, Fen Liu [09/27/13] 1 [1]
Best Practices for Columnstore Indexes Warner Chaves SQL MCM / MVP SQLTurbo.com Pythian.com.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8 “If you don’t find it in the index, look very.
1 Advanced Database Systems: DBS CB, 2 nd Edition Advanced Topics of Interest: In- Memory DB (IMDB) and Column-Oriented DB.
What is a database? (a supplement, not a substitute for Chapter 1…) some slides copied/modified from text Collection of Data? Data vs. information Example:
1 CS122A: Introduction to Data Management Lecture #15: Physical DB Design Instructor: Chen Li.
Index Building.
Practical Database Design and Tuning
Indexes By Adrienne Watt.
Indexing Structures for Files and Physical Database Design
Record Storage, File Organization, and Indexes
Indexing and hashing.
Physical Database Design
Advanced Database Systems: DBS CB, 2nd Edition
Physical Database Design and Performance
CSE-291 (Cloud Computing) Fall 2016
ITD1312 Database Principles Chapter 5: Physical Database Design
COMP 430 Intro. to Database Systems
Database System Implementation CSE 507
CHAPTER 5: PHYSICAL DATABASE DESIGN AND PERFORMANCE
Paritosh Aggarwal Rushi Nadimpally
Chapter 9: Database Systems
Database management concepts
Database Applications (15-415) DBMS Internals- Part VI Lecture 15, Oct 23, 2016 Mohammad Hammoud.
Physical Database Design
Chapter 6: Physical Database Design and Performance
CS222: Principles of Data Management Notes #09 Indexing Performance
Practical Database Design and Tuning
Relational Database Model
MANAGING DATA RESOURCES
CS222P: Principles of Data Management Notes #09 Indexing Performance
The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited)
Column-Stores vs. Row-Stores: How Different Are They Really?
Database management concepts
Flat Files & Relational Databases
Self-organizing Tuple Reconstruction in Column-stores
Chapter 11: Indexing and Hashing
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #08 Comparisons of Indexes and Indexing Performance Instructor: Chen Li.
Distributed Databases
Geographic Information Systems
Presentation transcript:

CSTORE E0261 Jayant Haritsa Computer Science and Automation Indian Institute of Science 1

Relational Database Table Attribute1 Attribute2 Attribute3 Record 1

Current DBMS -- “Row Store” Record 1 Record 2 Record 3 Record 4 E.g. DB2, Oracle, Sybase, SQLServer, …

Row Stores are Write Optimized Store fields in one record contiguously on disk Can insert and delete a record in one physical write Use small (e.g. 4K) disk blocks Suitable for on-line transaction processing (OLTP) where queries typically involve Small numbers of records (tuples) Frequent updates Many users Fast response times

In general, better to trade off cpu cycles for disk bandwidth Does it apply to OLAP Queries as well? OLAP Applications: Data warehouses, Business Process Management (BPM), Electronic library catalogs, etc. Mostly reads but with occasional writes. eg. rare bulk loading of new data Few relevant columns in ad-hoc queries. On an average only 10% relevant columns in a table Row-store not that good for “read-mostly” applications In general, better to trade off cpu cycles for disk bandwidth

All entries of a single column are stored contiguously What are Column Stores? All entries of a single column are stored contiguously

Storage Engine row scanner column scanner S S S SELECT name, age From Employee WHERE age > 40 Joe 45 … … Joe 45 … … S apply predicate(s) S TupId 45 TupId … name apply predicate #1 S age

Critique of Column Stores Advantages Fetch only required columns for a query Better cache effects Better compression (values within a column have same data type) Disadvantages Incurs extra joins due to tuple reconstructions of columns from same table Might need more space for storing the tuple identifiers But can be slower for other applications such as OLTP which could have many row inserts, …

C-Store Outline Data Model (Data Storage) Only materialized views (perhaps many) Compress the columns to save space Innovative redundancy Handling Transactional Updates Query Optimization Performance

Data Model Table – collection of attributes EMP(name, age, salary, dept) DEPT(dname, floor) Projections – set of columns. Intuitively, can be thought of as materialized views Base tables, from which the projections are derived, are not stored physically

Contd… Formally, projection of a table T is a Example projections A subset of columns of T (T could be a fact table), sorted on one (or more) columns Additionally, it can contain subset of columns from other tables (such as dimension tables) which have foreign-key relationships to T (conceptually) no duplicate elimination Example projections EMP1 (name, age | age) EMP2 (dept, age, DEPT.floor | DEPT.floor) EMP3 (name, salary | salary) DEPT1 (dname, floor | floor)

Projection Details Each projection is horizontally partitioned into “segments” Segment identifier Unit of distribution and parallelism Value-based partitioning, key range of sort key(s) Column-wise store inside each segment Storage Keys: Within a segment, every data value of every column is associated with a unique Storage Key Values from different columns with matching Storage key belong to the same logical row Virtual in Read Store, Explicit in Write Store

Vertical Partitioning: Example

Reconstructing Base Table from Projections Projections are joined using Storage Keys and Join Indexes Join Index Projection P1 has M segments, projection P2 has N segments P1 and P2 are on the same base table Join Index from P1 to P2 consists of An entry for each row of P1 which corresponds to matching row in P2 Each entry is of the form (s: Segment ID in P2, k: Storage Key in the Segment s) There are M join indexes for P1, one per segment Value-based joins but of system identifiers 

Example Construct EMP(name, age, salary) from EMP1 and EMP3 using join index on (EMP3 to EMP1) Needs multiple join indices for reconstructing a base table Join index is costly to store and maintain Therefore make each column part of several projections

Compressing Columnar Data Different encoding schemes for different columns Depends on ordering and value distribution Self-order, few distinct values: (value, position, num_entries) [4,12,7] Foreign-order, few distinct values: (value, bitmap), sparse bitmap is run-length encoded Self-order, many distinct values: block-oriented, delta value encoding 1,4,7,7,8,12 -> 1,3,3,0,1,4 Foreign-order, many distinct values: leave unencoded

Redundant Storage Hardly any warehouse is recovered by redo from log Takes too long! Store enough projections to ensure K-safety Columns are in sufficient different projections and sites Rebuild dead objects from elsewhere in the network

Handling Transactional Updates

Updates Are Necessary Transactional updates are necessary even in read-mostly environment Updates for error corrections Real-time data warehouses Rare Batch updates

Solution – a Hybrid Store Write-optimized Column store (Batch rebuilder) Tuple mover Read-optimized Column store (What we have been talking about so far)

Write Store Column store with same projections and join indexes as RS Horizontally partitioned as the read store 1:1 mapping between RS segments and WS segments Storage keys are explicitly stored and sorted using B-tree index Larger than the maximum in RS No compression (the data size is small)

Handling Updates Optimize read-only query: do not hold locks Snapshot isolation The query is run on a snapshot of the data as of time ET Record is visible if inserted before ET and deleted after ET Ensure transactions related to snapshot are already committed Coarse granularity timestamps called epochs” Each WS site: insertion vector (with timestamps), deletion vector, (updates become insertions and deletions) Maintain a high water mark and a low water mark of WS sites: HWM: all transactions before HWM have committed LWM: no records in RS are inserted after LWM, only deletions permitted

Handling Updates (contd) CC: Read-write transactions use Strict 2PL Recovery: Standard WAL with No-Force, Steal Only log UNDO records Redo from information available at other sites Allows dispensing with Prepare phase in 2PC

Tuple-Mover Read status of the RS segment Record last move time for this segment from WS in Tlast_move Update the RS only if Tlast_move  LWM Note: All changes are done into a new version of the RS segment, and updates are not done in place.

HWM and Epochs TA: time authority updates the coarse timer (epochs)

Query Optimization

Operators Decompress Select: generates bitstring Mask: bitstring+projection selected rows Project: choose a subset of columns Concat: combine multiple projections that are sorted in the same order Sort: All columns in a projection by some subset Permute: permute a projection according to a join index Join Aggregation operators and Bitstring operators

Column Optimizer Selinger-style cost-based query plan construction Chooses projections on which to run the query Cost model includes compression types Also chooses when to apply “mask” operator

Performance Results of CSTORE

Performance Benefits CStore is, on average, an order of magnitude faster than commercial row and column store Similar benefits is obtained wrt savings in storage space Reasons Avoids reads of unused columns Storing overlapping projections than the whole table Better compression of data However, queries (Q1-Q7) are designed to suit their system! Single-column outputs, with aggregates. Updates not tested!

END