mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Add the example
Добавил примеры.
This commit is contained in:
parent
7887f3892b
commit
eeec8004e8
@ -2240,6 +2240,8 @@ Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-refere
|
||||
|
||||
Returns the ID of the current query, which can be used instantly in other queries. Other parameters of a query can be extracted from the [system.query_log](../../operations/system-tables/query_log.md) table via `query_id`.
|
||||
|
||||
In contrast to [initialQueryID](#initial-query-id) function `queryID` can return different results on shards (see example). And then the server will argue that constant column has different values.
|
||||
|
||||
**Syntax**
|
||||
|
||||
``` sql
|
||||
@ -2252,10 +2254,22 @@ queryID()
|
||||
|
||||
Type: [String](../../sql-reference/data-types/string.md)
|
||||
|
||||
**Example**
|
||||
|
||||
In this example the result of the query will be three different values, one of which will match the `initial_query_id` for this query.
|
||||
|
||||
Query:
|
||||
|
||||
``` sql
|
||||
SELECT queryID() FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp');
|
||||
```
|
||||
|
||||
## initialQueryID {#initial-query-id}
|
||||
|
||||
Returns the ID of the initial current query, which can be used instantly in other queries. Other parameters of a query can be extracted from the [system.query_log](../../operations/system-tables/query_log.md) table via `initial_query_id`.
|
||||
|
||||
In contrast to [queryID](#query-id) function `initialQueryID` returns same results on shards (see example).
|
||||
|
||||
**Syntax**
|
||||
|
||||
``` sql
|
||||
@ -2267,3 +2281,13 @@ initialQueryID()
|
||||
- The ID of the initial current query.
|
||||
|
||||
Type: [String](../../sql-reference/data-types/string.md)
|
||||
|
||||
**Example**
|
||||
|
||||
In this example the result of the query will be three same values.
|
||||
|
||||
Query:
|
||||
|
||||
``` sql
|
||||
SELECT initialQueryID() FROM remote('127.0.0.{1..3}', currentDatabase(), 'tmp');
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user