Databases: Column Stores vs Row Stores A bird’s eye view Kameswara Venkatesh Emani HS 699 Speaking Skills and Oral Presentation IIT Bombay April 1, 2014 E. K. Venkatesh, IITB Column Store vs Row Store 1/14 Overview of the talk What is a Database? Classification of databases Rows vs Columns - Organization of data Advantages of Column Stores Quiz E. K. Venkatesh, IITB Column Store vs Row Store 2/14 What is a Database? Wikipedia: A database is an organized collection of data. Why organize? To easily create, read, update and delete data Software systems designed for this purpose are called Database Management Systems Examples: MySQL, Oracle, PostgreSQL, Microsoft SQL Server, SAP HANA etc. E. K. Venkatesh, IITB Column Store vs Row Store 3/14 Classification of Databases Relational : Tables, rows, columns Most widely used NoSQL: Other than relational Graph databases Key Value Stores Others Focus of this talk: Data organization in relational databases - rows vs columns E. K. Venkatesh, IITB Column Store vs Row Store 4/14 Relational Database - Terminology Collection of tables All rows in a table have the same attributes Example: A table EMPLOYEE has attributes EmpID, LastName, FirstName, Salary Columns store specific attribute values Rows can have keys to specify constraints Example: primary key uniquely identifies the row “All employees shall have a unique employee ID” 0 Image reference: [3] E. K. Venkatesh, IITB Column Store vs Row Store 5/14 Relational Database - Example Table Table EMPLOYEE: EmpID 1 2 3 E. K. Venkatesh, IITB LastName Smith Jones Johnson FirstName Joe Mary Cathy Column Store vs Row Store Salary 40000 50000 44000 6/14 Data Organization - Rows vs Columns Column Store Row store 0 Image references: [1, 2] E. K. Venkatesh, IITB Column Store vs Row Store 7/14 Column Store vs Row Store - Example EmpID 1 2 3 LastName Smith Jones Johnson Row Store 1,Smith,Joe,40000; 2,Jones,Mary,50000; 3,Johnson,Cathy,44000; E. K. Venkatesh, IITB FirstName Joe Mary Cathy Salary 40000 50000 44000 Column Store 1,2,3; Smith,Jones,Johnson; Joe,Mary,Cathy; 40000,50000,44000; Column Store vs Row Store 8/14 Column Stores - Advantages Read less data E. K. Venkatesh, IITB Column Store vs Row Store 9/14 Column Stores - Advantages Read less data Example: What is the average salary of an employee? Row Store 1,Smith,Joe,40000; 2,Jones,Mary,50000; 3,Johnson,Cathy,44000; Column Store 1,2,3; Smith,Jones,Johnson; Joe,Mary,Cathy; 40000,50000,44000; Row organization Read all data From each row, obtain salary Find average Column Organization Read salary data Find average E. K. Venkatesh, IITB Column Store vs Row Store 9/14 Column Stores - Advantages Compression - Run length, Bit vector, Dictionary, Heavy-weight schemes 0 Images from: [2] E. K. Venkatesh, IITB Column Store vs Row Store 10/14 Column Stores - Advantages Compression - Run length, Bit vector, Dictionary, Heavy-weight schemes Run Length encoding Bit-vector encoding 0 Images from: [2] E. K. Venkatesh, IITB Column Store vs Row Store 10/14 Summary Databases are organized collections of data There are various kinds of databases Relational databases are the most widely used Data in relational databases can be organized as rows or columns Column stores allow only the required data to be read good data compression E. K. Venkatesh, IITB Column Store vs Row Store 11/14 Quiz When might row stores be preferable over column stores? Hint: Think data read vs data write Data compression in column stores is better than in row stores. Why? Hint: Think similarity of adjacent data items Compression scheme A achieves 50% compression. Scheme B achieves 30% compression. However, Mr. DB Admin chooses scheme B over scheme A. What could be the reasons? Hint: Think decompression E. K. Venkatesh, IITB Column Store vs Row Store 12/14 References http://www.vldb2005.org/program/slides/thu/s553- stonebraker.ppt Stavros Harizopoulos et. al, Tutorial on Column-Oriented Database Systems, VLDB, 2009. Wikipedia - The Free Encyclopedia http://en.wikipedia.org E. K. Venkatesh, IITB Column Store vs Row Store 13/14 Thank You! E. K. Venkatesh, IITB Column Store vs Row Store 14/14
© Copyright 2026 Paperzz