diff --git a/docs/en/operations/table_engines/aggregatingmergetree.md b/docs/en/operations/table_engines/aggregatingmergetree.md index 72713cae3ffca43868c0fca1ba2a9cada595ab7f..4ebb707a98081cd0e622b57c274d6a9bd60d1ead 100644 --- a/docs/en/operations/table_engines/aggregatingmergetree.md +++ b/docs/en/operations/table_engines/aggregatingmergetree.md @@ -8,7 +8,7 @@ You can use `AggregatingMergeTree` tables for incremental data aggregation, incl The engine processes all columns with [AggregateFunction](../../data_types/nested_data_structures/aggregatefunction.md#data_type-aggregatefunction) type. -It is appropriate to use `AggregatingMergeTree` if it reduces the number of rows by orders. +It is appropriate to use `AggregatingMergeTree` if it reduces the number of rows by orders. ## Creating a Table @@ -29,11 +29,12 @@ For a description of request parameters, see [request description](../../query_l **Query clauses** -When creating a `ReplacingMergeTree` table the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. +When creating a `ReplacingMergeTree` table the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table -!!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. +!!! attention + Do not use this method in new projects and, if possible, switch the old projects to the method described above. ```sql CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] @@ -45,14 +46,15 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] ``` All of the parameters have the same meaning as in `MergeTree`. +
## SELECT and INSERT -To insert data, use `INSERT SELECT` query with aggregate `- State`- functions. +To insert data, use [INSERT SELECT](../../query_language/insert_into.md#queries-insert-select) query with aggregate `-State`- functions. -When selecting data from `AggregatingMergeTree` table, use `GROUP BY` clause and the same aggregate functions as when inserting data, but using `- Merge` suffix. +When selecting data from `AggregatingMergeTree` table, use `GROUP BY` clause and the same aggregate functions as when inserting data, but using `-Merge` suffix. -In the results of `SELECT` query the values of `AggregateFunction` type have implementation-specific binary representation for all of the ClickHouse output formats. If dump data into, for example, `TabSeparated` format with `SELECT` query then this dump can be loaded back using `INSERT` query. +In the results of `SELECT` query the values of `AggregateFunction` type have implementation-specific binary representation for all of the ClickHouse output formats. If dump data into, for example, `TabSeparated` format with `SELECT` query then this dump can be loaded back using `INSERT` query. ## Example of an Aggregated Materialized View diff --git a/docs/en/operations/table_engines/collapsingmergetree.md b/docs/en/operations/table_engines/collapsingmergetree.md index 9561f3ed0b94638eca1981e0e15fd37065206dec..8b48ef7f44db9e70cc17fa79dd47780357581fe8 100644 --- a/docs/en/operations/table_engines/collapsingmergetree.md +++ b/docs/en/operations/table_engines/collapsingmergetree.md @@ -2,7 +2,7 @@ # CollapsingMergeTree -The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree) and adds to data parts merge algorithm the logic of rows collapsing. +The engine inherits from [MergeTree](mergetree.md#table_engines-mergetree) and adds the logic of rows collapsing to data parts merge algorithm. `CollapsingMergeTree` deletes (collapses) pairs of rows by specific rules. The engine may significantly reduce the volume of storage and increase efficiency of `SELECT` query as a consequence. @@ -27,7 +27,7 @@ For a description of request parameters, see [request description](../../query_l **CollapsingMergeTree Parameters** -- `sign` — Name of the column with the type of row: `1` — "state" row, `-1` — "cancel" row. +- `sign` — Name of the column with the type of row: `1` is a "state" row, `-1` is a "cancel" row. Column data type — `Int8`. @@ -35,7 +35,7 @@ For a description of request parameters, see [request description](../../query_l When creating a `CollapsingMergeTree` table, the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table !!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. @@ -54,6 +54,7 @@ All of the parameters excepting `sign` have the same meaning as in `MergeTree`. - `sign` — Name of the column with the type of row: `1` — "state" row, `-1` — "cancel" row. Column Data Type — `Int8`. +
@@ -121,7 +122,7 @@ For each resulting data part ClickHouse saves: Thus, collapsing should not change the results of calculating statistics. Changes gradually collapsed so that in the end only the last state of almost every object left. -The `Sign` is required because the merging algorithm doesn't guarantee that all of the rows with the same primary key will be in the same resulting data part and even on the same physical server. ClickHouse process `SELECT` queries with multiple threads, and it can not predict the order of rows in the result. The aggregation is required if there is a need to get completely "collapsed" data from `CollapsingMergeTree` table. +The `Sign` is required because the merging algorithm doesn't guarantee that all of the rows with the same primary key will be in the same resulting data part and even on the same physical server. ClickHouse process `SELECT` queries with multiple threads, and it can not predict the order of rows in the result. The aggregation is required if there is a need to get completely "collapsed" data from `CollapsingMergeTree` table. To finalize collapsing write a query with `GROUP BY` clause and aggregate functions that account for the sign. For example, to calculate quantity, use `sum(Sign)` instead of `count()`. To calculate the sum of something, use `sum(Sign * x)` instead of `sum(x)`, and so on, and also add `HAVING sum(Sign) > 0`. @@ -166,7 +167,7 @@ INSERT INTO UAct VALUES (4324182021466249494, 5, 146, -1),(4324182021466249494, We use two `INSERT` queries to create two different data parts. If we insert the data with one query ClickHouse creates one data part and will not perform any merge ever. -Getting the data +Getting the data: ``` SELECT * FROM UAct diff --git a/docs/en/operations/table_engines/graphitemergetree.md b/docs/en/operations/table_engines/graphitemergetree.md index 2fc5deaad5deee04779ca5b0f3c71a553d017084..0aad07a13c304f24ed5580616ffe5b99c055f6b6 100644 --- a/docs/en/operations/table_engines/graphitemergetree.md +++ b/docs/en/operations/table_engines/graphitemergetree.md @@ -46,7 +46,7 @@ The names of these columns should be set in the rollup configuration. When creating a `GraphiteMergeTree` table, the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table !!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. @@ -66,7 +66,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] All of the parameters excepting `config_section` have the same meaning as in `MergeTree`. - `config_section` — Name of the section in the configuration file, where are the rules of rollup set. - +
## Rollup configuration diff --git a/docs/en/operations/table_engines/mergetree.md b/docs/en/operations/table_engines/mergetree.md index 410980d0432562775209c1726c517147dd4b90ab..7b4ecd51fe7b6cead6457a495de56985fa881a60 100644 --- a/docs/en/operations/table_engines/mergetree.md +++ b/docs/en/operations/table_engines/mergetree.md @@ -24,7 +24,7 @@ Main features: If necessary, you can set the data sampling method in the table. -!!!info +!!! info The [Merge](merge.md#table_engine-merge) engine does not belong to the `*MergeTree` family. @@ -76,7 +76,7 @@ We also set an expression for sampling as a hash by the user ID. This allows you `index_granularity` could be omitted because 8192 is the default value. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table !!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. @@ -104,6 +104,7 @@ MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID) ``` The `MergeTree` engine is configured in the same way as in the example above for the main engine configuration method. +
## Data Storage diff --git a/docs/en/operations/table_engines/replacingmergetree.md b/docs/en/operations/table_engines/replacingmergetree.md index a44cdd4f003434ad8f673205db7d4761b2deab58..7a4f3ab744380950bf981ed0dbcf524243b4c892 100644 --- a/docs/en/operations/table_engines/replacingmergetree.md +++ b/docs/en/operations/table_engines/replacingmergetree.md @@ -35,7 +35,7 @@ For a description of request parameters, see [request description](../../query_l When creating a `ReplacingMergeTree` table the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table !!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. @@ -53,5 +53,6 @@ All of the parameters excepting `ver` have the same meaning as in `MergeTree`. - `ver` - column with the version. Optional parameter. For a description, see the text above. +
[Original article](https://clickhouse.yandex/docs/en/operations/table_engines/replacingmergetree/) diff --git a/docs/en/operations/table_engines/summingmergetree.md b/docs/en/operations/table_engines/summingmergetree.md index 9839533bb15708913250d979ad4d498ecd53a06a..a2d89bfa4c8cab500cc1edecd6ceffe6636747a2 100644 --- a/docs/en/operations/table_engines/summingmergetree.md +++ b/docs/en/operations/table_engines/summingmergetree.md @@ -34,9 +34,10 @@ The columns must be of a numeric type and must not be in the primary key. When creating a `SummingMergeTree` table the same [clauses](mergetree.md#table_engines-mergetree-configuring) are required, as when creating a `MergeTree` table. -### Deprecated Method for Creating a Table +
Deprecated Method for Creating a Table -!!! attention Do not use this method in new projects and, if possible, switch the old projects to the method described above. +!!! attention + Do not use this method in new projects and, if possible, switch the old projects to the method described above. ``` CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] @@ -50,6 +51,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] All of the parameters excepting `columns` have the same meaning as in `MergeTree`. - `columns` — tuple with names of columns values of which will be summarized. Optional parameter. For a description, see the text above. +
## Usage Example diff --git a/docs/en/query_language/insert_into.md b/docs/en/query_language/insert_into.md index d34e306777bd336de39351ebb85517d2d267a88a..8af0c949191d72a08093683804592352ee59576f 100644 --- a/docs/en/query_language/insert_into.md +++ b/docs/en/query_language/insert_into.md @@ -12,7 +12,7 @@ INSERT INTO [db.]table [(c1, c2, c3)] VALUES (v11, v12, v13), (v21, v22, v23), . The query can specify a list of columns to insert `[(c1, c2, c3)]`. In this case, the rest of the columns are filled with: -- The values calculated from the `DEFAULT` expressions specified in the table definition. +- The values calculated from the `DEFAULT` expressions specified in the table definition. - Zeros and empty strings, if `DEFAULT` expressions are not defined. If [strict_insert_defaults=1](../operations/settings/settings.md#settings-strict_insert_defaults), columns that do not have `DEFAULT` defined must be listed in the query. @@ -41,6 +41,8 @@ INSERT INTO t FORMAT TabSeparated You can insert data separately from the query by using the command-line client or the HTTP interface. For more information, see the section "[Interfaces](../interfaces/index.md#interfaces)". + + ### Inserting The Results of `SELECT` ``` sql diff --git a/docs/ru/operations/table_engines/aggregatingmergetree.md b/docs/ru/operations/table_engines/aggregatingmergetree.md index 84e0e1933fb28afcfd9e1048fc1981029c2ab876..19ea9f9ff1bcac1c798d1ce7e6e04e1a34207545 100644 --- a/docs/ru/operations/table_engines/aggregatingmergetree.md +++ b/docs/ru/operations/table_engines/aggregatingmergetree.md @@ -32,7 +32,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] При создании таблицы `AggregatingMergeTree` используются те же [секции](mergetree.md#table_engines-mergetree-configuring), что и при создании таблицы `MergeTree`. -### Устаревший способ создания таблицы +
Устаревший способ создания таблицы !!! attention Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. @@ -47,6 +47,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] ``` Все параметры имеют то же значение, что в и `MergeTree`. +
## SELECT/INSERT данных diff --git a/docs/ru/operations/table_engines/mergetree.md b/docs/ru/operations/table_engines/mergetree.md index 6f7ea5f3071656aa50b27f7fd8fc8d8e9d4d057c..7d669afb346397916f50373f89c154f5bcd902df 100644 --- a/docs/ru/operations/table_engines/mergetree.md +++ b/docs/ru/operations/table_engines/mergetree.md @@ -75,7 +75,7 @@ ENGINE MergeTree() PARTITION BY toYYYYMM(EventDate) ORDER BY (CounterID, EventDa `index_granularity` можно было не указывать, поскольку 8192 — это значение по умолчанию. -### Устаревший способ создания таблицы +
Устаревший способ создания таблицы !!! attention Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. @@ -103,6 +103,7 @@ MergeTree(EventDate, intHash32(UserID), (CounterID, EventDate, intHash32(UserID) ``` Движок `MergeTree` сконфигурирован таким же образом, как и в примере выше для основного способа конфигурирования движка. +
## Хранение данных diff --git a/docs/ru/operations/table_engines/replacingmergetree.md b/docs/ru/operations/table_engines/replacingmergetree.md index 0f98c2980538159153268cd306117be4aebb3398..77f2f4894da92ba27660632c881c02c0050d3156 100644 --- a/docs/ru/operations/table_engines/replacingmergetree.md +++ b/docs/ru/operations/table_engines/replacingmergetree.md @@ -36,7 +36,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] При создании таблицы `ReplacingMergeTree` используются те же [секции](mergetree.md#table_engines-mergetree-configuring), что и при создании таблицы `MergeTree`. -### Устаревший способ создания таблицы +
Устаревший способ создания таблицы !!! attention Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. @@ -53,5 +53,6 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] Все параметры, кроме `ver` имеют то же значение, что в и `MergeTree`. - `ver` — столбец с версией. Необязательный параметр. Описание смотрите выше по тексту. +
[Оригинальная статья](https://clickhouse.yandex/docs/ru/operations/table_engines/replacingmergetree/) diff --git a/docs/ru/operations/table_engines/summingmergetree.md b/docs/ru/operations/table_engines/summingmergetree.md index c9b6ea8882e28a3bfaf4a27a72716a06838659de..97025aefe7f51584726307ec89f386ae6c04b880 100644 --- a/docs/ru/operations/table_engines/summingmergetree.md +++ b/docs/ru/operations/table_engines/summingmergetree.md @@ -34,7 +34,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] При создании таблицы `SummingMergeTree` использутся те же [секции](mergetree.md#table_engines-mergetree-configuring) запроса, что и при создании таблицы `MergeTree`. -### Устаревший способ создания таблицы +
Устаревший способ создания таблицы !!! attention Не используйте этот способ в новых проектах и по возможности переведите старые проекты на способ описанный выше. @@ -51,7 +51,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster] Все параметры, кроме `columns` имеют то же значение, что в и `MergeTree`. - `columns` — кортеж с именами столбцов для суммирования данных. Необязательный параметр. Описание смотрите выше по тексту. - +
## Пример использования