Distinctive features of ClickHouse

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/about-us/distinctive-features.md)

## True column-oriented database management system[​](#true-column-oriented-database-management-system "Direct link to True column-oriented database management system")

In a real column-oriented DBMS, no extra data is stored with the values. This means that constant-length values must be supported to avoid storing their length "number" next to the values. For example, a billion UInt8-type values should consume around 1 GB uncompressed, or this strongly affects the CPU use. It is essential to store data compactly (without any "garbage") even when uncompressed since the speed of decompression (CPU usage) depends mainly on the volume of uncompressed data.

This is in contrast to systems that can store values of different columns separately, but that can't effectively process analytical queries due to their optimization for other scenarios, such as HBase, Bigtable, Cassandra, and Hypertable. You would get throughput of around a hundred thousand rows per second in these systems, but not hundreds of millions of rows per second.

Finally, ClickHouse is a database management system, not a single database. It allows creating tables and databases in runtime, loading data, and running queries without reconfiguring and restarting the server.

## Data compression[​](#data-compression "Direct link to Data compression")

Some column-oriented DBMSs don't use data compression. However, data compression plays a key role in achieving excellent performance.

In addition to efficient general-purpose compression codecs with different trade-offs between disk space and CPU consumption, ClickHouse provides [specialized codecs](/docs/sql-reference/statements/create/table#specialized-codecs) for specific kinds of data, which allows ClickHouse to compete with and outperform more niche databases, like time-series ones.

## Disk storage of data[​](#disk-storage-of-data "Direct link to Disk storage of data")

Keeping data physically sorted by primary key makes it possible to extract data based on specific values or value ranges with low latency in less than a few dozen milliseconds. Some column-oriented DBMSs, such as SAP HANA and Google PowerDrill, can only work in RAM. This approach requires allocation of a larger hardware budget than necessary for real-time analysis.

ClickHouse is designed to work on regular hard drives, which means the cost per GB of data storage is low, but SSD and additional RAM are also fully used if available.

## Parallel processing on multiple cores[​](#parallel-processing-on-multiple-cores "Direct link to Parallel processing on multiple cores")

Large queries are parallelized naturally, taking all the necessary resources available on the current server.

## Distributed processing on multiple servers[​](#distributed-processing-on-multiple-servers "Direct link to Distributed processing on multiple servers")

Almost none of the columnar DBMSs mentioned above have support for distributed query processing.

In ClickHouse, data can reside on different shards. Each shard can be a group of replicas used for fault tolerance. All shards are used to run a query in parallel, transparently for the user.

## SQL support[​](#sql-support "Direct link to SQL support")

ClickHouse supports [a declarative query language](/docs/sql-reference) based on SQL that is mostly compatible with the ANSI SQL standard.

Supported queries include [GROUP BY](/docs/sql-reference/statements/select/group-by), [ORDER BY](/docs/sql-reference/statements/select/order-by), subqueries in [FROM](/docs/sql-reference/statements/select/from), the [JOIN](/docs/sql-reference/statements/select/join) clause, the [IN](/docs/sql-reference/operators/in) operator, [window functions](/docs/sql-reference/window-functions) and scalar subqueries.

Correlated (dependent) subqueries aren't supported at the time of writing but might become available in the future.

## Vector computation engine[​](#vector-engine "Direct link to Vector computation engine")

Data isn't only stored by columns but is processed by vectors (parts of columns), which allows achieving high CPU efficiency.

## Real-time data inserts[​](#real-time-data-updates "Direct link to Real-time data inserts")

ClickHouse supports tables with a primary key. To quickly perform queries on the range of the primary key, the data is sorted incrementally using the merge tree. Due to this, data can continually be added to the table. No locks are taken when new data is ingested.

## Primary indexes[​](#primary-index "Direct link to Primary indexes")

Having data physically sorted by primary key makes it possible to extract data based on specific values or value ranges with low latency in less than a few dozen milliseconds.

## Secondary indexes[​](#secondary-indexes "Direct link to Secondary indexes")

Unlike other database management systems, secondary indexes in ClickHouse don't point to specific rows or row ranges. Instead, they allow the database to know in advance that all rows in some data parts wouldn't match the query filtering conditions and don't read them at all, thus they're called [data skipping indexes](/docs/engines/table-engines/mergetree-family/mergetree#table_engine-mergetree-data_skipping-indexes).

## Suitable for online queries[​](#suitable-for-online-queries "Direct link to Suitable for online queries")

Most OLAP database management systems don't aim for online queries with sub-second latencies. In alternative systems, report building time of tens of seconds or even minutes is often considered acceptable. Sometimes it takes even more time, which forces systems to prepare reports offline (in advance or by responding with "come back later").

In ClickHouse, "low latency" means that queries can be processed without delay and without trying to prepare an answer in advance, right at the moment when the user interface page is loading — in other words, *online*.

## Support for approximated calculations[​](#support-for-approximated-calculations "Direct link to Support for approximated calculations")

ClickHouse provides various ways to trade accuracy for performance:

1. Aggregate functions for approximated calculation of the number of distinct values, medians, and quantiles.
2. Running a query based on a part ([SAMPLE](/docs/sql-reference/statements/select/sample)) of data and getting an approximated result. In this case, proportionally less data is retrieved from the disk.
3. Running an aggregation for a limited number of random keys, instead of for all keys. Under certain conditions for key distribution in the data, this provides a reasonably accurate result while using fewer resources.

## Adaptive join algorithm[​](#adaptive-join-algorithm "Direct link to Adaptive join algorithm")

ClickHouse adaptively chooses how to [JOIN](/docs/sql-reference/statements/select/join) multiple tables, by preferring hash join and falling back to merge join if there's more than one large table.

## Data replication and data integrity support[​](#data-replication-and-data-integrity-support "Direct link to Data replication and data integrity support")

ClickHouse uses asynchronous multi-master replication. After being written to any available replica, all the remaining replicas retrieve their copy in the background. The system maintains identical data on different replicas. Recovery after most failures is performed automatically, or semi-automatically in complex cases.

For more information, see the section [Data replication](/docs/engines/table-engines/mergetree-family/replication).

## Role-Based Access Control[​](#role-based-access-control "Direct link to Role-Based Access Control")

ClickHouse implements user account management using SQL queries and allows for [role-based access control configuration](/docs/operations/access-rights) similar to what can be found in the ANSI SQL standard and popular relational database management systems.

## Features that can be considered disadvantages[​](#clickhouse-features-that-can-be-considered-disadvantages "Direct link to Features that can be considered disadvantages")