Columnar Storage: Read Less Data, Analyze Faster
Columnar formats like Parquet store data by column, not by row. This makes analytical queries that select a few columns from a wide table incredibly fast by minimizing disk I/O. It's a poor fit for transactional workloads that need entire rows at once.
WHY IT EXISTS: Traditional databases store data row-by-row, which is efficient for fetching entire records like a user's full profile. But for analytics on massive datasets, you often only need a few columns. Row-based storage forces the system to read terabytes of useless data from disk just to access the few columns it needs, creating a huge I/O bottleneck.
THE MENTAL MODEL: Imagine a massive spreadsheet of customer data with 100 columns. A row-store saves this data like a CSV, one full row after another. To calculate the average purchase amount, you have to read every cell in every row. A columnar store, like Apache Parquet, is like tearing that spreadsheet into 100 separate lists, one for each column. To get the average purchase amount, you only need to read that single list, ignoring the other 99.
HOW IT WORKS: Parquet physically groups all the values for a single column together on disk. This approach has two major advantages. First, a query only reads the specific columns it needs, drastically reducing the amount of data read from storage (I/O). Second, data within a single column is often of the same type and has lower entropy (e.g., a 'country' column has many repeated values). This homogeneity makes the data highly compressible, leading to smaller file sizes and even faster reads.
WHEN TO USE IT: Columnar formats are the standard for Online Analytical Processing (OLAP) and big data warehousing. Use them for large-scale analytical queries in systems like Apache Spark, Presto/Trino, DuckDB, and Snowflake. They excel when you have "wide" tables (many columns) but your queries are "narrow" (accessing only a few columns at a time), which is typical for business intelligence and data science.
WHEN NOT TO USE IT: Avoid columnar formats for Online Transaction Processing (OLTP) systems. These are your typical application databases that handle high volumes of reads, writes, and updates on individual records. For example, fetching a user's complete profile to display on a webpage is inefficient, as the database has to "stitch together" the row from multiple separate column files. For these use cases, traditional row-based storage is much faster.
ONE CANONICAL EXAMPLE: An e-commerce platform logs every user click into a table with 200 columns. A data analyst wants to find the total revenue from a specific promotion. The query SELECT SUM(price) FROM clicks only needs the price column. With Parquet, the query engine reads only the data for the price column, skipping the other 199 columns entirely, making the query orders of magnitude faster than on a row-based file like a CSV.
Read the original → parquet.apache.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.