mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #21587 from gyuton/gyuton-DOCSUP-6703-Document-the-insert_shard_id-setting
DOCSUP-6703: Documented the insert_shard_id setting
This commit is contained in:
commit
290e8e6b87
@ -1883,6 +1883,53 @@ Possible values:
|
||||
|
||||
Default value: `0`.
|
||||
|
||||
## insert_shard_id {#insert_shard_id}
|
||||
|
||||
If not `0`, specifies the shard of [Distributed](../../engines/table-engines/special/distributed.md#distributed) table into which the data will be inserted synchronously.
|
||||
|
||||
If `insert_shard_id` value is incorrect, the server will throw an exception.
|
||||
|
||||
To get the number of shards on `requested_cluster`, you can check server config or use this query:
|
||||
|
||||
``` sql
|
||||
SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster';
|
||||
```
|
||||
|
||||
Possible values:
|
||||
|
||||
- 0 — Disabled.
|
||||
- Any number from `1` to `shards_num` of corresponding [Distributed](../../engines/table-engines/special/distributed.md#distributed) table.
|
||||
|
||||
Default value: `0`.
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
CREATE TABLE x AS system.numbers ENGINE = MergeTree ORDER BY number;
|
||||
CREATE TABLE x_dist AS x ENGINE = Distributed('test_cluster_two_shards_localhost', currentDatabase(), x);
|
||||
INSERT INTO x_dist SELECT * FROM numbers(5) SETTINGS insert_shard_id = 1;
|
||||
SELECT * FROM x_dist ORDER BY number ASC;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
``` text
|
||||
┌─number─┐
|
||||
│ 0 │
|
||||
│ 0 │
|
||||
│ 1 │
|
||||
│ 1 │
|
||||
│ 2 │
|
||||
│ 2 │
|
||||
│ 3 │
|
||||
│ 3 │
|
||||
│ 4 │
|
||||
│ 4 │
|
||||
└────────┘
|
||||
```
|
||||
|
||||
## use_compact_format_in_distributed_parts_names {#use_compact_format_in_distributed_parts_names}
|
||||
|
||||
Uses compact format for storing blocks for async (`insert_distributed_sync`) INSERT into tables with `Distributed` engine.
|
||||
|
@ -1759,6 +1759,54 @@ ClickHouse генерирует исключение
|
||||
|
||||
- [Движок Distributed](../../engines/table-engines/special/distributed.md#distributed)
|
||||
- [Управление распределёнными таблицами](../../sql-reference/statements/system.md#query-language-system-distributed)
|
||||
|
||||
## insert_shard_id {#insert_shard_id}
|
||||
|
||||
Если не `0`, указывает, в какой шард [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы данные будут вставлены синхронно.
|
||||
|
||||
Если значение настройки `insert_shard_id` указано неверно, сервер выдаст ошибку.
|
||||
|
||||
Узнать количество шардов `shard_num` на кластере `requested_cluster` можно из конфигурации сервера, либо используя запрос:
|
||||
|
||||
``` sql
|
||||
SELECT uniq(shard_num) FROM system.clusters WHERE cluster = 'requested_cluster';
|
||||
```
|
||||
|
||||
Возможные значения:
|
||||
|
||||
- 0 — выключено.
|
||||
- Любое число от `1` до `shards_num` соответствующей [Distributed](../../engines/table-engines/special/distributed.md#distributed) таблицы.
|
||||
|
||||
Значение по умолчанию: `0`.
|
||||
|
||||
**Пример**
|
||||
|
||||
Запрос:
|
||||
|
||||
```sql
|
||||
CREATE TABLE x AS system.numbers ENGINE = MergeTree ORDER BY number;
|
||||
CREATE TABLE x_dist AS x ENGINE = Distributed('test_cluster_two_shards_localhost', currentDatabase(), x);
|
||||
INSERT INTO x_dist SELECT * FROM numbers(5) SETTINGS insert_shard_id = 1;
|
||||
SELECT * FROM x_dist ORDER BY number ASC;
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
||||
``` text
|
||||
┌─number─┐
|
||||
│ 0 │
|
||||
│ 0 │
|
||||
│ 1 │
|
||||
│ 1 │
|
||||
│ 2 │
|
||||
│ 2 │
|
||||
│ 3 │
|
||||
│ 3 │
|
||||
│ 4 │
|
||||
│ 4 │
|
||||
└────────┘
|
||||
```
|
||||
|
||||
## validate_polygons {#validate_polygons}
|
||||
|
||||
Включает или отключает генерирование исключения в функции [pointInPolygon](../../sql-reference/functions/geo/index.md#pointinpolygon), если многоугольник самопересекающийся или самокасающийся.
|
||||
|
Loading…
Reference in New Issue
Block a user