> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# What is a columnar database?

> A columnar database stores the data of each column independently. This allows reading data from disk only for those columns that are used in any given query.

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

{frontMatter.description}

<h2 id="introduction">
  Introduction
</h2>

A columnar database stores the data of each column independently. This allows reading data from disk only for those columns used in any given query. The cost is that operations that affect whole rows become proportionally more expensive. A columnar database is a synonym for a column-oriented database management system. ClickHouse is a typical example of such a system.

<h2 id="advantages-of-a-columnar-database">
  Advantages of a columnar database
</h2>

Key columnar database advantages are:

* Queries that use only a few columns out of many.
* Aggregating queries against large volumes of data.
* Column-wise data compression.

<h2 id="row-oriented-vs-column-oriented-databases">
  Row-oriented vs column-oriented databases
</h2>

Here is an illustration of the difference between traditional row-oriented systems and columnar databases when building reports:

**Traditional row-oriented**

<Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/0xkAyEEn8ANRFZGQ/images/row-oriented.gif?s=65d32283890f54b87398e0bddf1a0ec3" alt="Illustration of traditional row-oriented database storage" size="md" width="630" height="258" data-path="images/row-oriented.gif" />

**Columnar**

<Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/ddNWBC5mE_w-syUp/images/column-oriented.gif?s=43234d1f2e731088ce5e59de023a4d00" alt="Illustration of columnar database storage" size="md" width="630" height="258" data-path="images/column-oriented.gif" />

A columnar database is the preferred choice for analytical applications because it allows having many columns in a table just in case but does not pay the cost for unused columns on read query execution time (a traditional OLTP database reads all of the data during queries as the data is stored in rows and not columns). Column-oriented databases are designed for big data processing and data warehousing. They often natively scale using distributed clusters of low-cost hardware to increase throughput. ClickHouse does it with a combination of [distributed](/reference/engines/table-engines/special/distributed) and [replicated](/reference/engines/table-engines/mergetree-family/replication) tables.
