SlideShare a Scribd company logo
Row or Columnar Database
1
©asquareb llc
If someone is evaluating database or data stores to use in their application, there are so many options to
choose from especially in the data ware house space. If narrowed down to the relational database (RDBMS)
paradigm, one of the choices to make is whether to use row based or columnar based database. Vendors
claim superiority of one over the other on whether their product is columnar or row based. So we looked into
the details about columnar and row databases to understand the fundamental differences. The following is the
summary.
Why the name?
Row Based RDBMS (R-RDBMS):
In a row based DBMS, data related to a tuple (row) i.e. all the column data are stored contiguously on disk.
For IO efficiency, disk reads and writes are done at block size, for e.g. a 4K (4096 byte) block size by
Operating Systems. Database management systems use “pages” of size which is a multiple of the block size to
read and write data to disk. In R-RDBMS rows of data are stored in data pages and if the row size is less than
half the page size, then multiple rows are stored in a single page. When a row is required by a query, the
whole page in which the row is stored is retrieved back from the disk into the memory for further processing.
The following is a representative page layout based on one of the RDBMS used in the industry.
As we can see the R-RDBMS stores additional information regarding each page and rows with in the page to
help with maintaining the ACID (Atomicity, Consistency, Isolation, Durability) property expected out of
RDBMS.
In order to improve query performance, R-RDBMS uses additional structure called indexes. Indexes store the
indexed column value, the page in which the row with the indexed column value is stored on disk and the
offset within the page to reach out to the particular row. If an index is not present, when a query is executed
against a table, the DBMS needs to read through all the pages from the disk pertaining to the table to find the
rows which satisfy the query. If the index is present and the query uses the indexed columns in its predicate,
the DBMS can use the index to identify the rows which satisfy the query and read the pages where the rows
are stored reducing the time to identify the rows. This also reduces the amount of data read from the disk i.e.
Data Page
Page Header
(20 Bytes)
Row
Header
(6 bytes)
(
Row Data
Row
Header
(6 bytes)
(
Trail
byte
Row
Pointer
Row
Pointer
Col 1
Col 1 Col 2
Col 2
…
Row Data
Row or Columnar Database
2
©asquareb llc
reducing the slowest operation in the query processing sequence which is disk IO. The following is a
representative index page in a typical DBMS. There can be other representations based on various index
structures like BTree, Bit map etc.
Columnar RDBMS (C-RDBMS):
As you may have guessed, columnar databases store each column data from all the tuples together. The
following diagram shows the translation of data storage between a row based DBMS and columnar DBMS.
Contrary to storing all the column data corresponding to a row sequentially in a page, values for each column
in rows are stored together in the same page. This results in data for each row getting stored in different
pages. When a query requires data for a row, column data for the row is pulled from all the pages storing the
column values, appends them together before returning it to the user as a single row. The sequence in which
the column values are stored in the database pages determines the row to which corresponds to. For e.g. the
second entry stored in the various pages “ID2”, “Mark”, “Waugh”, ”Researcher” corresponds to the same
row which is row 2.
By storing the columns separately, each column acts as an index since the sequence of storage identifies the
row. For e.g. if a query requests the row with first name ‘Steve’ the DBMS can identify the row number using
Index Page
Page Header
Col 2 Page Id + Offset
Col 2 Page Id + Offset
ID1
ID2
ID3
Mark Antony
Mark Waugh
Steve Aurelius
Engineer
Researcher
Engineer
ID1 ID2 ID3
…
Mark Mark Steve
…
Antony Waugh Aurelius
…
Engineer Researcher Engineer
…
Row DB page to Columnar DB page
Data Page
Page Header
(20 Bytes)
Row
Header
(6 bytes)
(
Row Data
Row
Header
(6 bytes)
(
Trail
byte
Row
Pointer
Row
Pointer
Col 1 Col 2
…
Row Data
Col 1 Col 2
Row or Columnar Database
3
©asquareb llc
the pages storing the column “First Name” which in this case is row 3. Then the DBMS can retrieve the third
entry from pages storing all the other column values stitch them together and return the row back to the user.
How they differ?
Given the understanding of the key difference between R and C-RDBMS, we can look at how they differ
operationally.
 If the usage pattern involves retrieval and update of all or most of the columns in a row like in an
OLTP application, then R-RDBMS is a better option than the C-RDBMS. The reason being that the
C-RDBMS needs to retrieve the columns values separately and stitch them together to return the row
as a response and this doesn’t provide the performance expected in an OLTP environment. Also in C-
RDBMS updates need to be made on multiple pages in contrast to updating a single page in R-RDBMS
which is inefficient. C-RDBMS is primarily suited for data ware housing where the usage pattern is read
only.
 If the usage pattern involves retrieval of all the columns in a row in bulk, then R-RDBMS is a better
option due to the same reason described above. But if the bulk retrieval involves only a small subset of
columns, then the C-RDBMS will perform better. The reason being that C-RDBMS can deal with the
subset of columns since they are stored separately while R-RDBMS need to bring in all the rows and
columns into memory from the disk and process it through CPU to eliminate the unwanted columns.
Some R-RDBMS products like Netezza may be able to eliminate the unwanted columns using
specialized hardware during disk read but still need to deal with all the rows columns.
 If the usage pattern involves aggregation on columns then C-RDBMS performs better than the R-
RDBMS since they can act on individual columns efficiently compared to R-RDBMS.
 C-RDBMS can implement optimization techniques like late materialization where conditions on
columns can be applied separately, identify the rows which satisfies all the conditions before retrieving
the columns to generate rows whereas R-RDBMS needs to retrieve rows much earlier to identify the
satisfying rows and to return to the user.
 Storage required for C-RDBMS will be less than the R-RDBMS since they don’t have the same page
and row overheads as R-RDBMS. Also they don’t need additional structures like indexes since the
columns themselves act as indexes.
 Compression on data is efficient on C-RDBMS since data which are similar are stored together
compared to R-RDBMS where mixed data in rows are stored together. This helps reduce space usage
in C-RDBMS and also improves the disk IO since the data is much compressed.
Can R-RDBMS implement C-RDBMS?
One can try to mimic C-RDBMS storage in an R-RDBMS using any of the following techniques
 Store columns as separate tables with a common identifier column to identify the row to which the
columns value corresponds to.
Row or Columnar Database
4
©asquareb llc
 Create indexes for each of the columns in a table so that queries can be satisfied by using the indexes
only.
Also there are commercial DBMS products which support both columnar and row based storage. Apart from
the increased (more than double) storage requirement to implement these techniques, research from MIT
database group shows that these techniques do not provide the same performance as the C-RDBMS for all
the usage patterns for which C-RDBMS is best suited for.
Summary
C-RDBMS are more suited for data warehousing use cases and it is how they are utilized currently in the
industry. Also C-RDBMS may perform much better when usage involves small set of column retrieval and
column aggregations. R-RDBMS are good for use cases where data is dealt at the row level and where
updates are often made on rows. C-RDBMS and R-RDBMS vendors may find ways to incorporate some of
the advantages of the other in their product. The key is to understand the data usage pattern and choose the
best product which matches the usage. Even though we have eliminated other complexities in a typical
DBMS system and looked only at the fundamental difference between R and C RDBMS, hope it helps you
choose the best option for your application.
bnair@asquareb.com
blog.asquareb.com
https://github.com/bijugs
@gsbiju
http://www.slideshare.net/bijugs
Ad

More Related Content

What's hot (20)

Etl techniques
Etl techniquesEtl techniques
Etl techniques
mahezabeenIlkal
 
Adbms 17 object query language
Adbms 17 object query languageAdbms 17 object query language
Adbms 17 object query language
Vaibhav Khanna
 
Conceptual vs. Logical vs. Physical Data Modeling
Conceptual vs. Logical vs. Physical Data ModelingConceptual vs. Logical vs. Physical Data Modeling
Conceptual vs. Logical vs. Physical Data Modeling
DATAVERSITY
 
Présentation data vault et bi v20120508
Présentation data vault et bi v20120508Présentation data vault et bi v20120508
Présentation data vault et bi v20120508
Empowered Holdings, LLC
 
Using the Chebotko Method to Design Sound and Scalable Data Models for Apache...
Using the Chebotko Method to Design Sound and Scalable Data Models for Apache...Using the Chebotko Method to Design Sound and Scalable Data Models for Apache...
Using the Chebotko Method to Design Sound and Scalable Data Models for Apache...
Artem Chebotko
 
Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...
Javed Khan
 
Parquet Strata/Hadoop World, New York 2013
Parquet Strata/Hadoop World, New York 2013Parquet Strata/Hadoop World, New York 2013
Parquet Strata/Hadoop World, New York 2013
Julien Le Dem
 
Data warehouse
Data warehouseData warehouse
Data warehouse
shachibattar
 
2.2 decision tree
2.2 decision tree2.2 decision tree
2.2 decision tree
Krish_ver2
 
Presto
PrestoPresto
Presto
Knoldus Inc.
 
Introduction to Data Vault Modeling
Introduction to Data Vault ModelingIntroduction to Data Vault Modeling
Introduction to Data Vault Modeling
Kent Graziano
 
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Beat Signer
 
Lecture 7 data structures and algorithms
Lecture 7 data structures and algorithmsLecture 7 data structures and algorithms
Lecture 7 data structures and algorithms
Aakash deep Singhal
 
Link Analysis for Web Information Retrieval
Link Analysis for Web Information RetrievalLink Analysis for Web Information Retrieval
Link Analysis for Web Information Retrieval
Carlos Castillo (ChaTo)
 
Hive
HiveHive
Hive
Bala Krishna
 
b+ tree
b+ treeb+ tree
b+ tree
bitistu
 
Unit 5-hive data types – primitive and complex data
Unit 5-hive data types – primitive and complex dataUnit 5-hive data types – primitive and complex data
Unit 5-hive data types – primitive and complex data
vishal choudhary
 
Efficient Data Storage for Analytics with Apache Parquet 2.0
Efficient Data Storage for Analytics with Apache Parquet 2.0Efficient Data Storage for Analytics with Apache Parquet 2.0
Efficient Data Storage for Analytics with Apache Parquet 2.0
Cloudera, Inc.
 
Naive bayes
Naive bayesNaive bayes
Naive bayes
umeskath
 
Resilient Distributed DataSets - Apache SPARK
Resilient Distributed DataSets - Apache SPARKResilient Distributed DataSets - Apache SPARK
Resilient Distributed DataSets - Apache SPARK
Taposh Roy
 
Adbms 17 object query language
Adbms 17 object query languageAdbms 17 object query language
Adbms 17 object query language
Vaibhav Khanna
 
Conceptual vs. Logical vs. Physical Data Modeling
Conceptual vs. Logical vs. Physical Data ModelingConceptual vs. Logical vs. Physical Data Modeling
Conceptual vs. Logical vs. Physical Data Modeling
DATAVERSITY
 
Présentation data vault et bi v20120508
Présentation data vault et bi v20120508Présentation data vault et bi v20120508
Présentation data vault et bi v20120508
Empowered Holdings, LLC
 
Using the Chebotko Method to Design Sound and Scalable Data Models for Apache...
Using the Chebotko Method to Design Sound and Scalable Data Models for Apache...Using the Chebotko Method to Design Sound and Scalable Data Models for Apache...
Using the Chebotko Method to Design Sound and Scalable Data Models for Apache...
Artem Chebotko
 
Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...
Javed Khan
 
Parquet Strata/Hadoop World, New York 2013
Parquet Strata/Hadoop World, New York 2013Parquet Strata/Hadoop World, New York 2013
Parquet Strata/Hadoop World, New York 2013
Julien Le Dem
 
2.2 decision tree
2.2 decision tree2.2 decision tree
2.2 decision tree
Krish_ver2
 
Introduction to Data Vault Modeling
Introduction to Data Vault ModelingIntroduction to Data Vault Modeling
Introduction to Data Vault Modeling
Kent Graziano
 
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Beat Signer
 
Lecture 7 data structures and algorithms
Lecture 7 data structures and algorithmsLecture 7 data structures and algorithms
Lecture 7 data structures and algorithms
Aakash deep Singhal
 
Link Analysis for Web Information Retrieval
Link Analysis for Web Information RetrievalLink Analysis for Web Information Retrieval
Link Analysis for Web Information Retrieval
Carlos Castillo (ChaTo)
 
Unit 5-hive data types – primitive and complex data
Unit 5-hive data types – primitive and complex dataUnit 5-hive data types – primitive and complex data
Unit 5-hive data types – primitive and complex data
vishal choudhary
 
Efficient Data Storage for Analytics with Apache Parquet 2.0
Efficient Data Storage for Analytics with Apache Parquet 2.0Efficient Data Storage for Analytics with Apache Parquet 2.0
Efficient Data Storage for Analytics with Apache Parquet 2.0
Cloudera, Inc.
 
Naive bayes
Naive bayesNaive bayes
Naive bayes
umeskath
 
Resilient Distributed DataSets - Apache SPARK
Resilient Distributed DataSets - Apache SPARKResilient Distributed DataSets - Apache SPARK
Resilient Distributed DataSets - Apache SPARK
Taposh Roy
 

Viewers also liked (10)

Using Netezza Query Plan to Improve Performace
Using Netezza Query Plan to Improve PerformaceUsing Netezza Query Plan to Improve Performace
Using Netezza Query Plan to Improve Performace
Biju Nair
 
Project Risk Management
Project Risk ManagementProject Risk Management
Project Risk Management
Biju Nair
 
Concurrency
ConcurrencyConcurrency
Concurrency
Biju Nair
 
Websphere MQ (MQSeries) fundamentals
Websphere MQ (MQSeries) fundamentalsWebsphere MQ (MQSeries) fundamentals
Websphere MQ (MQSeries) fundamentals
Biju Nair
 
HDFS User Reference
HDFS User ReferenceHDFS User Reference
HDFS User Reference
Biju Nair
 
Netezza workload management
Netezza workload managementNetezza workload management
Netezza workload management
Biju Nair
 
Netezza fundamentals for developers
Netezza fundamentals for developersNetezza fundamentals for developers
Netezza fundamentals for developers
Biju Nair
 
Apache HBase Performance Tuning
Apache HBase Performance TuningApache HBase Performance Tuning
Apache HBase Performance Tuning
Lars Hofhansl
 
NENUG Apr14 Talk - data modeling for netezza
NENUG Apr14 Talk - data modeling for netezzaNENUG Apr14 Talk - data modeling for netezza
NENUG Apr14 Talk - data modeling for netezza
Biju Nair
 
HBase Application Performance Improvement
HBase Application Performance ImprovementHBase Application Performance Improvement
HBase Application Performance Improvement
Biju Nair
 
Using Netezza Query Plan to Improve Performace
Using Netezza Query Plan to Improve PerformaceUsing Netezza Query Plan to Improve Performace
Using Netezza Query Plan to Improve Performace
Biju Nair
 
Project Risk Management
Project Risk ManagementProject Risk Management
Project Risk Management
Biju Nair
 
Websphere MQ (MQSeries) fundamentals
Websphere MQ (MQSeries) fundamentalsWebsphere MQ (MQSeries) fundamentals
Websphere MQ (MQSeries) fundamentals
Biju Nair
 
HDFS User Reference
HDFS User ReferenceHDFS User Reference
HDFS User Reference
Biju Nair
 
Netezza workload management
Netezza workload managementNetezza workload management
Netezza workload management
Biju Nair
 
Netezza fundamentals for developers
Netezza fundamentals for developersNetezza fundamentals for developers
Netezza fundamentals for developers
Biju Nair
 
Apache HBase Performance Tuning
Apache HBase Performance TuningApache HBase Performance Tuning
Apache HBase Performance Tuning
Lars Hofhansl
 
NENUG Apr14 Talk - data modeling for netezza
NENUG Apr14 Talk - data modeling for netezzaNENUG Apr14 Talk - data modeling for netezza
NENUG Apr14 Talk - data modeling for netezza
Biju Nair
 
HBase Application Performance Improvement
HBase Application Performance ImprovementHBase Application Performance Improvement
HBase Application Performance Improvement
Biju Nair
 
Ad

Similar to Row or Columnar Database (20)

Choosing your NoSQL storage
Choosing your NoSQL storageChoosing your NoSQL storage
Choosing your NoSQL storage
Imteyaz Khan
 
Rdbms vs. no sql
Rdbms vs. no sqlRdbms vs. no sql
Rdbms vs. no sql
Amar Jagdale
 
Vertica
VerticaVertica
Vertica
Andrey Sidelev
 
MapReduce and parallel DBMSs: friends or foes?
MapReduce and parallel DBMSs: friends or foes?MapReduce and parallel DBMSs: friends or foes?
MapReduce and parallel DBMSs: friends or foes?
Spyros Eleftheriadis
 
Database
DatabaseDatabase
Database
Zahid Soomro
 
Bigtable osdi06
Bigtable osdi06Bigtable osdi06
Bigtable osdi06
Shahbaz Sidhu
 
Bigtable
Bigtable Bigtable
Bigtable
kartheektrainings
 
Rise of Column Oriented Database
Rise of Column Oriented DatabaseRise of Column Oriented Database
Rise of Column Oriented Database
Suvradeep Rudra
 
White paper on cassandra
White paper on cassandraWhite paper on cassandra
White paper on cassandra
Navanit Katiyar
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
Tariqul islam
 
2.Introduction to NOSQL (Core concepts).pptx
2.Introduction to NOSQL (Core concepts).pptx2.Introduction to NOSQL (Core concepts).pptx
2.Introduction to NOSQL (Core concepts).pptx
RushikeshChikane2
 
Column oriented Transactions
Column oriented TransactionsColumn oriented Transactions
Column oriented Transactions
Aerial Telecom Solutions (ATS) Pvt. Ltd.
 
Storage cassandra
Storage   cassandraStorage   cassandra
Storage cassandra
PL dream
 
Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013
Yadhu Kiran
 
Streaming Analytics Unit 5 notes for engineers
Streaming Analytics Unit 5 notes for engineersStreaming Analytics Unit 5 notes for engineers
Streaming Analytics Unit 5 notes for engineers
ManjuAppukuttan2
 
No sql databases
No sql databasesNo sql databases
No sql databases
Walaa Hamdy Assy
 
Databases and its representation
Databases and its representationDatabases and its representation
Databases and its representation
Ruhull
 
Mdb dn 2016_04_check_constraints
Mdb dn 2016_04_check_constraintsMdb dn 2016_04_check_constraints
Mdb dn 2016_04_check_constraints
Daniel M. Farrell
 
Chapter02
Chapter02Chapter02
Chapter02
sasa_eldoby
 
Beyond Aurora. Scale-out SQL databases for AWS
Beyond Aurora. Scale-out SQL databases for AWS Beyond Aurora. Scale-out SQL databases for AWS
Beyond Aurora. Scale-out SQL databases for AWS
Clustrix
 
Choosing your NoSQL storage
Choosing your NoSQL storageChoosing your NoSQL storage
Choosing your NoSQL storage
Imteyaz Khan
 
MapReduce and parallel DBMSs: friends or foes?
MapReduce and parallel DBMSs: friends or foes?MapReduce and parallel DBMSs: friends or foes?
MapReduce and parallel DBMSs: friends or foes?
Spyros Eleftheriadis
 
Rise of Column Oriented Database
Rise of Column Oriented DatabaseRise of Column Oriented Database
Rise of Column Oriented Database
Suvradeep Rudra
 
White paper on cassandra
White paper on cassandraWhite paper on cassandra
White paper on cassandra
Navanit Katiyar
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
Tariqul islam
 
2.Introduction to NOSQL (Core concepts).pptx
2.Introduction to NOSQL (Core concepts).pptx2.Introduction to NOSQL (Core concepts).pptx
2.Introduction to NOSQL (Core concepts).pptx
RushikeshChikane2
 
Storage cassandra
Storage   cassandraStorage   cassandra
Storage cassandra
PL dream
 
Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013
Yadhu Kiran
 
Streaming Analytics Unit 5 notes for engineers
Streaming Analytics Unit 5 notes for engineersStreaming Analytics Unit 5 notes for engineers
Streaming Analytics Unit 5 notes for engineers
ManjuAppukuttan2
 
Databases and its representation
Databases and its representationDatabases and its representation
Databases and its representation
Ruhull
 
Mdb dn 2016_04_check_constraints
Mdb dn 2016_04_check_constraintsMdb dn 2016_04_check_constraints
Mdb dn 2016_04_check_constraints
Daniel M. Farrell
 
Beyond Aurora. Scale-out SQL databases for AWS
Beyond Aurora. Scale-out SQL databases for AWS Beyond Aurora. Scale-out SQL databases for AWS
Beyond Aurora. Scale-out SQL databases for AWS
Clustrix
 
Ad

More from Biju Nair (8)

Chef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scaleChef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scale
Biju Nair
 
HBase Internals And Operations
HBase Internals And OperationsHBase Internals And Operations
HBase Internals And Operations
Biju Nair
 
Apache Kafka Reference
Apache Kafka ReferenceApache Kafka Reference
Apache Kafka Reference
Biju Nair
 
Serving queries at low latency using HBase
Serving queries at low latency using HBaseServing queries at low latency using HBase
Serving queries at low latency using HBase
Biju Nair
 
Multi-Tenant HBase Cluster - HBaseCon2018-final
Multi-Tenant HBase Cluster - HBaseCon2018-finalMulti-Tenant HBase Cluster - HBaseCon2018-final
Multi-Tenant HBase Cluster - HBaseCon2018-final
Biju Nair
 
Cursor Implementation in Apache Phoenix
Cursor Implementation in Apache PhoenixCursor Implementation in Apache Phoenix
Cursor Implementation in Apache Phoenix
Biju Nair
 
Hadoop security
Hadoop securityHadoop security
Hadoop security
Biju Nair
 
Chef patterns
Chef patternsChef patterns
Chef patterns
Biju Nair
 
Chef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scaleChef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scale
Biju Nair
 
HBase Internals And Operations
HBase Internals And OperationsHBase Internals And Operations
HBase Internals And Operations
Biju Nair
 
Apache Kafka Reference
Apache Kafka ReferenceApache Kafka Reference
Apache Kafka Reference
Biju Nair
 
Serving queries at low latency using HBase
Serving queries at low latency using HBaseServing queries at low latency using HBase
Serving queries at low latency using HBase
Biju Nair
 
Multi-Tenant HBase Cluster - HBaseCon2018-final
Multi-Tenant HBase Cluster - HBaseCon2018-finalMulti-Tenant HBase Cluster - HBaseCon2018-final
Multi-Tenant HBase Cluster - HBaseCon2018-final
Biju Nair
 
Cursor Implementation in Apache Phoenix
Cursor Implementation in Apache PhoenixCursor Implementation in Apache Phoenix
Cursor Implementation in Apache Phoenix
Biju Nair
 
Hadoop security
Hadoop securityHadoop security
Hadoop security
Biju Nair
 
Chef patterns
Chef patternsChef patterns
Chef patterns
Biju Nair
 

Recently uploaded (20)

Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 

Row or Columnar Database

  • 1. Row or Columnar Database 1 ©asquareb llc If someone is evaluating database or data stores to use in their application, there are so many options to choose from especially in the data ware house space. If narrowed down to the relational database (RDBMS) paradigm, one of the choices to make is whether to use row based or columnar based database. Vendors claim superiority of one over the other on whether their product is columnar or row based. So we looked into the details about columnar and row databases to understand the fundamental differences. The following is the summary. Why the name? Row Based RDBMS (R-RDBMS): In a row based DBMS, data related to a tuple (row) i.e. all the column data are stored contiguously on disk. For IO efficiency, disk reads and writes are done at block size, for e.g. a 4K (4096 byte) block size by Operating Systems. Database management systems use “pages” of size which is a multiple of the block size to read and write data to disk. In R-RDBMS rows of data are stored in data pages and if the row size is less than half the page size, then multiple rows are stored in a single page. When a row is required by a query, the whole page in which the row is stored is retrieved back from the disk into the memory for further processing. The following is a representative page layout based on one of the RDBMS used in the industry. As we can see the R-RDBMS stores additional information regarding each page and rows with in the page to help with maintaining the ACID (Atomicity, Consistency, Isolation, Durability) property expected out of RDBMS. In order to improve query performance, R-RDBMS uses additional structure called indexes. Indexes store the indexed column value, the page in which the row with the indexed column value is stored on disk and the offset within the page to reach out to the particular row. If an index is not present, when a query is executed against a table, the DBMS needs to read through all the pages from the disk pertaining to the table to find the rows which satisfy the query. If the index is present and the query uses the indexed columns in its predicate, the DBMS can use the index to identify the rows which satisfy the query and read the pages where the rows are stored reducing the time to identify the rows. This also reduces the amount of data read from the disk i.e. Data Page Page Header (20 Bytes) Row Header (6 bytes) ( Row Data Row Header (6 bytes) ( Trail byte Row Pointer Row Pointer Col 1 Col 1 Col 2 Col 2 … Row Data
  • 2. Row or Columnar Database 2 ©asquareb llc reducing the slowest operation in the query processing sequence which is disk IO. The following is a representative index page in a typical DBMS. There can be other representations based on various index structures like BTree, Bit map etc. Columnar RDBMS (C-RDBMS): As you may have guessed, columnar databases store each column data from all the tuples together. The following diagram shows the translation of data storage between a row based DBMS and columnar DBMS. Contrary to storing all the column data corresponding to a row sequentially in a page, values for each column in rows are stored together in the same page. This results in data for each row getting stored in different pages. When a query requires data for a row, column data for the row is pulled from all the pages storing the column values, appends them together before returning it to the user as a single row. The sequence in which the column values are stored in the database pages determines the row to which corresponds to. For e.g. the second entry stored in the various pages “ID2”, “Mark”, “Waugh”, ”Researcher” corresponds to the same row which is row 2. By storing the columns separately, each column acts as an index since the sequence of storage identifies the row. For e.g. if a query requests the row with first name ‘Steve’ the DBMS can identify the row number using Index Page Page Header Col 2 Page Id + Offset Col 2 Page Id + Offset ID1 ID2 ID3 Mark Antony Mark Waugh Steve Aurelius Engineer Researcher Engineer ID1 ID2 ID3 … Mark Mark Steve … Antony Waugh Aurelius … Engineer Researcher Engineer … Row DB page to Columnar DB page Data Page Page Header (20 Bytes) Row Header (6 bytes) ( Row Data Row Header (6 bytes) ( Trail byte Row Pointer Row Pointer Col 1 Col 2 … Row Data Col 1 Col 2
  • 3. Row or Columnar Database 3 ©asquareb llc the pages storing the column “First Name” which in this case is row 3. Then the DBMS can retrieve the third entry from pages storing all the other column values stitch them together and return the row back to the user. How they differ? Given the understanding of the key difference between R and C-RDBMS, we can look at how they differ operationally.  If the usage pattern involves retrieval and update of all or most of the columns in a row like in an OLTP application, then R-RDBMS is a better option than the C-RDBMS. The reason being that the C-RDBMS needs to retrieve the columns values separately and stitch them together to return the row as a response and this doesn’t provide the performance expected in an OLTP environment. Also in C- RDBMS updates need to be made on multiple pages in contrast to updating a single page in R-RDBMS which is inefficient. C-RDBMS is primarily suited for data ware housing where the usage pattern is read only.  If the usage pattern involves retrieval of all the columns in a row in bulk, then R-RDBMS is a better option due to the same reason described above. But if the bulk retrieval involves only a small subset of columns, then the C-RDBMS will perform better. The reason being that C-RDBMS can deal with the subset of columns since they are stored separately while R-RDBMS need to bring in all the rows and columns into memory from the disk and process it through CPU to eliminate the unwanted columns. Some R-RDBMS products like Netezza may be able to eliminate the unwanted columns using specialized hardware during disk read but still need to deal with all the rows columns.  If the usage pattern involves aggregation on columns then C-RDBMS performs better than the R- RDBMS since they can act on individual columns efficiently compared to R-RDBMS.  C-RDBMS can implement optimization techniques like late materialization where conditions on columns can be applied separately, identify the rows which satisfies all the conditions before retrieving the columns to generate rows whereas R-RDBMS needs to retrieve rows much earlier to identify the satisfying rows and to return to the user.  Storage required for C-RDBMS will be less than the R-RDBMS since they don’t have the same page and row overheads as R-RDBMS. Also they don’t need additional structures like indexes since the columns themselves act as indexes.  Compression on data is efficient on C-RDBMS since data which are similar are stored together compared to R-RDBMS where mixed data in rows are stored together. This helps reduce space usage in C-RDBMS and also improves the disk IO since the data is much compressed. Can R-RDBMS implement C-RDBMS? One can try to mimic C-RDBMS storage in an R-RDBMS using any of the following techniques  Store columns as separate tables with a common identifier column to identify the row to which the columns value corresponds to.
  • 4. Row or Columnar Database 4 ©asquareb llc  Create indexes for each of the columns in a table so that queries can be satisfied by using the indexes only. Also there are commercial DBMS products which support both columnar and row based storage. Apart from the increased (more than double) storage requirement to implement these techniques, research from MIT database group shows that these techniques do not provide the same performance as the C-RDBMS for all the usage patterns for which C-RDBMS is best suited for. Summary C-RDBMS are more suited for data warehousing use cases and it is how they are utilized currently in the industry. Also C-RDBMS may perform much better when usage involves small set of column retrieval and column aggregations. R-RDBMS are good for use cases where data is dealt at the row level and where updates are often made on rows. C-RDBMS and R-RDBMS vendors may find ways to incorporate some of the advantages of the other in their product. The key is to understand the data usage pattern and choose the best product which matches the usage. Even though we have eliminated other complexities in a typical DBMS system and looked only at the fundamental difference between R and C RDBMS, hope it helps you choose the best option for your application. [email protected] blog.asquareb.com https://github.com/bijugs @gsbiju http://www.slideshare.net/bijugs