ClickHouse/clickhouse-docs-embeddings huggingface dataset:
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/guides/examples/aggregate_function_combinators/sumArray.md)

## Description[​](#description "Direct link to Description")

The [`Array`](/docs/sql-reference/aggregate-functions/combinators#-array) combinator
can be applied to the [`sum`](/docs/sql-reference/aggregate-functions/reference/sum)
function to calculate the sum of all elements in an array, using the `sumArray`
aggregate combinator function.

The `sumArray` function is useful when you need to calculate the total sum of
all elements across multiple arrays in a dataset.

## Example usage[​](#example-usage "Direct link to Example usage")

In this example, we'll use a sample dataset of daily sales across different
product categories to demonstrate how `sumArray` works. We'll calculate the total
sales across all categories for each day.

```
CREATE TABLE daily_category_sales
(
    date Date,
    category_sales Array(UInt32)
) ENGINE = Memory;

INSERT INTO daily_category_sales VALUES
    ('2024-01-01', [100, 200, 150]),
    ('2024-01-02', [120, 180, 160]),
    ('2024-01-03', [90, 220, 140]);

SELECT 
    date,
    category_sales,
    sumArray(category_sales) AS total_sales_sumArray,
    sum(arraySum(category_sales)) AS total_sales_arraySum
FROM daily_category_sales
GROUP BY date, category_sales;
```

The `sumArray` function will sum up all elements in each `category_sales` array.
For example, on `2024-01-01`, it sums `100 + 200 + 150 = 450`. This gives the
same result as `arraySum`.

## See also[​](#see-also "Direct link to See also")

- [`sum`](/docs/sql-reference/aggregate-functions/reference/sum)
- [`arraySum`](/docs/sql-reference/functions/array-functions#arraySum)
- [`Array combinator`](/docs/sql-reference/aggregate-functions/combinators#-array)
- [`sumMap`](/docs/examples/aggregate-function-combinators/sumMap)

- [Description](#description)- [Example usage](#example-usage)- [See also](#see-also)

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/guides/examples/aggregate_function_combinators/sumForEach.md)

## Description[​](#description "Direct link to Description")

The [`ForEach`](/docs/sql-reference/aggregate-functions/combinators#-foreach) combinator
can be applied to the [`sum`](/docs/sql-reference/aggregate-functions/reference/sum) aggregate function to turn it from an aggregate
function which operates on row values to an aggregate function which operates on
array columns, applying the aggregate to each element in the array across rows.

## Example usage[​](#example-usage "Direct link to Example usage")

For this example we'll make use of the `hits` dataset available in our [SQL playground](https://sql.clickhouse.com/).

The `hits` table contains a column called `isMobile` of type UInt8 which can be
`0` for Desktop or `1` for mobile:

```
SELECT EventTime, IsMobile FROM metrica.hits ORDER BY rand() LIMIT 10
```

We'll use the `sumForEach` aggregate combinator function to analyze how
desktop versus mobile traffic varies by hour of the day. Click the play button
below to run the query interactively:

```
SELECT
    toHour(EventTime) AS hour_of_day,
    -- Use sumForEach to count desktop and mobile visits in one pass
    sumForEach([
        IsMobile = 0, -- Desktop visits (IsMobile = 0)
        IsMobile = 1  -- Mobile visits (IsMobile = 1)
    ]) AS device_counts
FROM metrica.hits
GROUP BY hour_of_day
ORDER BY hour_of_day;
```

## See also[​](#see-also "Direct link to See also")

- [`sum`](/docs/sql-reference/aggregate-functions/reference/sum)
- [`ForEach` combinator](/docs/sql-reference/aggregate-functions/combinators#-foreach)

- [Description](#description)- [Example usage](#example-usage)- [See also](#see-also)

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/guides/examples/aggregate_function_combinators/uniqArray.md)

## Description[​](#description "Direct link to Description")

The [`Array`](/docs/sql-reference/aggregate-functions/combinators#-array) combinator
can be applied to the [`uniq`](/docs/sql-reference/aggregate-functions/reference/uniq)
function to calculate the approximate number of unique elements across all arrays,
using the `uniqArray` aggregate combinator function.

The `uniqArray` function is useful when you need to count unique elements across
multiple arrays in a dataset. It's equivalent to using `uniq(arrayJoin())`, where
`arrayJoin` first flattens the arrays and then `uniq` counts the unique elements.

## Example usage[​](#example-usage "Direct link to Example usage")

In this example, we'll use a sample dataset of user interests across different
categories to demonstrate how `uniqArray` works. We'll compare it with
`uniq(arrayJoin())` to show the difference in counting unique elements.

```
CREATE TABLE user_interests
(
    user_id UInt32,
    interests Array(String)
) ENGINE = Memory;

INSERT INTO user_interests VALUES
    (1, ['reading', 'gaming', 'music']),
    (2, ['gaming', 'sports', 'music']),
    (3, ['reading', 'cooking']);

SELECT 
    uniqArray(interests) AS unique_interests_total,
    uniq(arrayJoin(interests)) AS unique_interests_arrayJoin
FROM user_interests;
```

The `uniqArray` function counts unique elements across all arrays combined, similar to `uniq(arrayJoin())`.
In this example:

- `uniqArray` returns 5 because there are 5 unique interests across all users: 'reading', 'gaming', 'music', 'sports', 'cooking'
- `uniq(arrayJoin())` also returns 5, showing that both functions count unique elements across all arrays

```
   ┌─unique_interests_total─┬─unique_interests_arrayJoin─┐
1. │                      5 │                          5 │
   └────────────────────────┴────────────────────────────┘
```

## See also[​](#see-also "Direct link to See also")

- [`uniq`](/docs/sql-reference/aggregate-functions/reference/uniq)
- [`arrayJoin`](/docs/sql-reference/functions/array-join)
- [`Array combinator`](/docs/sql-reference/aggregate-functions/combinators#-array)
- [`uniqCombined`](/docs/sql-reference/aggregate-functions/reference/uniqcombined)

- [Description](#description)- [Example usage](#example-usage)- [See also](#see-also)

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/index.md)

- [What is ClickHouse?](/docs/intro)
- [Why is ClickHouse so fast?](/docs/concepts/why-clickhouse-is-so-fast)
- [Who is using ClickHouse?](/docs/faq/general/who-is-using-clickhouse)
- [What does "ClickHouse" mean?](/docs/faq/general/dbms-naming)
- [What does "Не тормозит" mean?](/docs/faq/general/ne-tormozit)
- [What is OLAP?](/docs/faq/general/olap)
- [What is a columnar database?](/docs/faq/general/columnar-database)
- [How do I choose a primary key?](/docs/guides/best-practices/sparse-primary-indexes)
- [Why not use something like MapReduce?](/docs/faq/general/mapreduce)
- [How do I contribute code to ClickHouse?](/docs/knowledgebase/how-do-i-contribute-code-to-clickhouse)

Don't see what you're looking for?

Check out our [Knowledge Base](/docs/knowledgebase) and also browse the many helpful articles found here in the documentation.

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/columnar-database.md)

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. The cost is that operations that affect whole rows become proportionally more expensive. The synonym for a columnar database is a column-oriented database management system. ClickHouse is a typical example of such a system.

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.

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

**Traditional row-oriented**

![Traditional row-oriented database](/docs/assets/images/row-oriented-3e6fd5aa48e3075202d242b4799da8fa.gif)

**Columnar**

![Columnar database](/docs/assets/images/column-oriented-d082e49b7743d4ded32c7952bfdb028f.gif)

A columnar database is the preferred choice for analytical applications because it allows having many columns in a table just in case, but to 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 combination of [distributed](/docs/engines/table-engines/special/distributed) and [replicated](/docs/engines/table-engines/mergetree-family/replication) tables.

If you'd like a deep dive into the history of column databases, how they differ from row-oriented databases, and the use cases for a column database, see [the column databases guide](https://clickhouse.com/engineering-resources/what-is-columnar-database).

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/concurrency.md)

ClickHouse is designed for real-time analytical applications that can serve external users directly. It can serve analytical queries with low latency (less than 10 milliseconds) and high concurrency (exceeding 10,000 queries per second) on petabyte-scale databases, combining historical data and real-time insertions.

This is possible thanks to the efficient indexing structure, flexible caching, and available configurations like projections and materialized views.

Builtin role-based access control, resource usage quotas, configurable query complexity guardrails, workload scheduler, make ClickHouse ideal as a serving layer on top of analytical data.

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/cost-based.md)

ClickHouse has certain isolated cost-based optimization mechanics, such as: the order of reading columns is determined by the cost of reading compressed ranges of data from disk.

ClickHouse also does JOIN reordering based on column statistics, however, this is (as of 2025) not nearly as advanced as CBE in Postgres, Oracle, MS SQL Server.

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/datalake.md)

ClickHouse supports data lakes, including Iceberg, Delta Lake, Apache Hudi, Apache Paimon, Hive.

It provides support for **reading** and **writing**, full compatibility with partition pruning, statistics-based pruning, schema evolution, positional deletes, equality deletes, time travel, and introspection.

Data Lakes in ClickHouse are supported with **Unity**, **AWS Glue**, **Rest**, **Polaris**, and **Hive Metastore** catalogs, as well as individual tables.

Query performance on data lakes is top-notch thanks to distributed processing, efficient native Parquet reader, and data files caching.

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/dbms-naming.md)

It's a combination of "**Click**stream" and "Data ware**House**". It comes from the original use case at Yandex.Metrica, where ClickHouse was supposed to keep records of all clicks by people from all over the Internet, and it still does the job. You can read more about this use case on [ClickHouse history](/docs/about-us/history) page.

This two-part meaning has two consequences:

- The only correct way to write Click**H**ouse is with capital H.
- If you need to abbreviate it, use **CH**. For some historical reasons, abbreviating as CK is also popular in China, mostly because one of the first talks about ClickHouse in Chinese used this form.

References

Many years after ClickHouse got its name, this approach of combining two words that are meaningful on their own has been highlighted as the best way to name a database in a [research by Andy Pavlo](https://www.cs.cmu.edu/~pavlo/blog/2020/03/on-naming-a-database-management-system.html), an Associate Professor of Databases at Carnegie Mellon University. ClickHouse shared his "best database name of all time" award with Postgres.

Was this page helpful?
What are the 3rd-party dependencies for running ClickHouse?

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/dependencies.md)

ClickHouse doesn't have any runtime dependencies. It is distributed as a single binary application which is fully self-contained. This application provides all the functionality of the cluster, serves queries, acts as a worker node in the cluster, as a coordination system providing the RAFT consensus algorithm, as a client or a local query engine.

This unique architecture choice differentiates it from other systems, that often have dedicated frontend, backend, or aggregation nodes, as it makes the deployment, cluster management, and monitoring easier.

References

Many years ago, ClickHouse used to require ZooKeeper for coordination of distributed clusters. It is no longer needed, and while we support using ZooKeeper, it's no longer recommended.

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/federated.md)

ClickHouse has the most comprehensive support for federated queries and hybrid query execution among analytical databases.

It supports querying external databases:

- PostgreSQL
- MySQL
- MongoDB
- Redis
- any ODBC data source
- any JDBC data source
- any Arrow Flight data source
- streaming data sources, such as Kafka and RabbitMQ
- Data Lakes, such as Iceberg, Delta Lake, Apache Hudi, Apache Paimon
- external files located on a shared storage, such as AWS S3, GCS, Minio, Cloudflare R2, Azure Blob Storage, Alicloud OSS, Tencent COS, as well as local storage, with the wide range of data formats

ClickHouse can join multiple different data sources in a single query. It also provides a hybrid query execution option, combining local resources and offloading part of the query to remote machines.

Interestingly that ClickHouse can accelerate queries on external data sources without moving the data. For example, an aggregation query from MySQL will be processed faster if run on ClickHouse, because the overhead of data movement is offset by the faster query engine.

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/mapreduce.md)

We can refer to systems like MapReduce as distributed computing systems in which the reduce operation is based on distributed sorting. The most common open-source solution in this class is [Apache Hadoop](http://hadoop.apache.org).

These systems aren't appropriate for online queries due to their high latency. In other words, they can't be used as the back-end for a web interface. These types of systems aren't useful for real-time data updates. Distributed sorting isn't the best way to perform reduce operations if the result of the operation and all the intermediate results (if there are any) are located in the RAM of a single server, which is usually the case for online queries. In such a case, a hash table is an optimal way to perform reduce operations. A common approach to optimizing map-reduce tasks is pre-aggregation (partial reduce) using a hash table in RAM. The user performs this optimization manually. Distributed sorting is one of the main causes of reduced performance when running simple map-reduce tasks.

Most MapReduce implementations allow you to execute arbitrary code on a cluster. But a declarative query language is better suited to OLAP to run experiments quickly. For example, Hadoop has Hive and Pig. Also consider Cloudera Impala or Shark (outdated) for Spark, as well as Spark SQL, Presto, and Apache Drill. Performance when running such tasks is highly sub-optimal compared to specialized systems, but relatively high latency makes it unrealistic to use these systems as the backend for a web interface.

Was this page helpful?
What does "Не тормозит" mean?

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/ne-tormozit.md)

We often get this question when people see vintage (limited production) ClickHouse t-shirts. They have the words **"ClickHouse не тормозит"** written in big bold text on the front.

Before ClickHouse became open-source, it was developed as an in-house storage system by a large European IT company, [Yandex](https://yandex.com/company/). That's why it initially got its slogan in Cyrillic, which is "не тормозит" (pronounced as "ne tormozit"). After the open-source release, we first produced some of those t-shirts for local events, and it was a no-brainer to use the slogan as-is.

A second batch of these t-shirts was supposed to be given away at international events, and we tried to make an English version of the slogan.
Unfortunately, we just couldn't come up with a punchy equivalent in English. The original phrase is elegant in its expression while being succinct, and restrictions on space on the t-shirt meant that we failed to come up with a good enough translation as most options appeared to be either too long or inaccurate.
We decided to keep the slogan even on t-shirts produced for international events. It appeared to be a great decision because people all over the world were positively surprised and curious when they saw it.

So, what does it mean? Here are some ways to translate *"не тормозит"*:

- If you translate it literally, it sounds something like *"ClickHouse doesn't press the brake pedal"*.
- Shorter, but less precise translations might be *"ClickHouse isn't slow"*, *"ClickHouse doesn't lag"* or just *"ClickHouse is fast"*.

If you haven't seen one of those t-shirts in person, you can check them out online in many ClickHouse-related videos. For example, this one:

*P.S. These t-shirts aren't for sale*, they were given away for free at some [ClickHouse Meetups](https://www.meetup.com/pro/clickhouse/), usually as a gift for best questions or other forms of active participation. Now, these t-shirts are no longer produced, and they have become highly valued collector's items.

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/sql.md)

ClickHouse has complete support for SQL syntax, including features such as:

- SQL/JSON and JSON data type (SQL-2023)
- Window functions (SQL-2003)
- Common table expressions and recursive queries (SQL-1999)
- ROLLUP, CUBE, and GROUPING SETS (SQL-1999)
- Full support for RBAC (SQL-1999)
- Correlated subqueries (SQL-1992);

The support is validated by TPC-H and TPC-DS benchmarks, as well as by SQLTest.

ClickHouse introduced many features before they were subsequently standardised by ISO/IEC, such as:

- conditional aggregate functions
- `any` aggregate functions
- `least` and `greatest`
- `GROUP BY ALL`
- extended use of aliases
- underscores in numeric literals

ClickHouse extend the SQL by introducing major quality-of-life improvements:

- unrestricted use of aliases
- aliases inside the WITH clause
- aggregate function combinators
- parameterized aggregate functions
- approximate aggregate functions
- native and big integer numeric data types, extended precision decimal
- higher order functions for arrays manipulation
- ARRAY JOIN clause and arrayJoin function
- array aggregation
- LIMIT BY clause
- GROUP BY WITH TOTALS
- AS OF JOIN
- ANY/ALL JOIN
- natural syntax for JSON
- trailing comma in the column list
- FROM ... SELECT clause order
- type-safe query parameters and parameterized views

Some of them have a chance to be included in the upcoming SQL standards, while already being available for ClickHouse users.

Was this page helpful?
title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/updates.md)

ClickHouse supports the UPDATE statement and is capable running real-time updates as fast as it runs INSERTs.

This is possible thanks to the [patch parts data structure](https://clickhouse.com/blog/updates-in-clickhouse-2-sql-style-updates#stage-3-patch-parts--updates-the-clickhouse-way), which allows quickly applying changes without a significant impact on the SELECT performance.

Moreover, due to MVCC (multi-version concurrency control) and snapshot isolation, updates provide ACID properties.

References

Lightweight updates were first introduced in ClickHouse version 25.7.

Was this page helpful?
Who is using ClickHouse?

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/faq/general/who-is-using-clickhouse.md)

Being an open-source product makes this question not so straightforward to answer. You don't have to tell anyone if you want to start using ClickHouse, you just go grab source code or pre-compiled packages. There's no contract to sign and the [Apache 2.0 license](https://github.com/ClickHouse/ClickHouse/blob/master/LICENSE) allows for unconstrained software distribution.

Also, the technology stack is often in a grey zone of what's covered by an NDA. Some companies consider technologies they use as a competitive advantage even if they're open-source and don't allow employees to share any details publicly. Some see some PR risks and allow employees to share implementation details only with their PR department approval.

So how to tell who is using ClickHouse?

One way is to **ask around**. If it's not in writing, people are much more willing to share what technologies are used in their companies, what the use cases are, what kind of hardware is used, data volumes, etc. We're talking with users regularly on [ClickHouse Meetups](https://www.youtube.com/channel/UChtmrD-dsdpspr42P_PyRAw/playlists) all over the world and have heard stories about 1000+ companies that use ClickHouse. Unfortunately, that's not reproducible and we try to treat such stories as if they were told under NDA to avoid any potential troubles. But you can come to any of our future meetups and talk with other users on your own. There are multiple ways how meetups are announced, for example, you can subscribe to [our Twitter](https://twitter.com/ClickHouseDB/).

The second way is to look for companies **publicly saying** that they use ClickHouse. It's more substantial because there's usually some hard evidence like a blog post, talk video recording, slide deck, etc. We collect the collection of links to such evidence on our **[Adopters](/docs/about-us/adopters)** page. Feel free to contribute the story of your employer or just some links you've stumbled upon (but try not to violate your NDA in the process).

You can find names of very large companies in the adopters list, like Bloomberg, Cisco, China Telecom, Tencent, or Lyft, but with the first approach, we found that there are many more. For example, if you take [the list of largest IT companies by Forbes (2020)](https://www.forbes.com/sites/hanktucker/2020/05/13/worlds-largest-technology-companies-2020-apple-stays-on-top-zoom-and-uber-debut/) over half of them are using ClickHouse in some way. Also, it would be unfair not to mention [Yandex](/docs/about-us/history), the company which initially open-sourced ClickHouse in 2016 and happens to be one of the largest IT companies in Europe.

Was this page helpful?