add dynamic and nested dynamic

This commit is contained in:
DanRoscigno 2023-05-01 14:06:50 -04:00
parent 30dd645b4f
commit fa4ab93f21

View File

@ -736,7 +736,7 @@ Disks, volumes and storage policies should be declared inside the `<storage_conf
:::tip :::tip
Disks can also be declared in the `SETTINGS` section of a query. This is useful Disks can also be declared in the `SETTINGS` section of a query. This is useful
for adhoc analysis to temporarily attach a disk that is, for example, hosted at a URL. for adhoc analysis to temporarily attach a disk that is, for example, hosted at a URL.
See [nested dynamic storage](#nested-dynamic-storage) for more details. See [dynamic storage](#dynamic-storage) for more details.
::: :::
Configuration structure: Configuration structure:
@ -882,11 +882,46 @@ You could change storage policy after table creation with [ALTER TABLE ... MODIF
The number of threads performing background moves of data parts can be changed by [background_move_pool_size](/docs/en/operations/server-configuration-parameters/settings.md/#background_move_pool_size) setting. The number of threads performing background moves of data parts can be changed by [background_move_pool_size](/docs/en/operations/server-configuration-parameters/settings.md/#background_move_pool_size) setting.
### Dynamic Storage
This example query shows how to attach a table stored at a URL and configure the
remote storage within the query. The web storage is not configured in the ClickHouse
configuration files; all the settings are in the ATTACH query.
```sql
ATTACH TABLE uk_price_paid UUID 'cf712b4f-2ca8-435c-ac23-c4393efe52f7'
(
price UInt32,
date Date,
postcode1 LowCardinality(String),
postcode2 LowCardinality(String),
type Enum8('other' = 0, 'terraced' = 1, 'semi-detached' = 2, 'detached' = 3, 'flat' = 4),
is_new UInt8,
duration Enum8('unknown' = 0, 'freehold' = 1, 'leasehold' = 2),
addr1 String,
addr2 String,
street LowCardinality(String),
locality LowCardinality(String),
town LowCardinality(String),
district LowCardinality(String),
county LowCardinality(String)
)
ENGINE = MergeTree
ORDER BY (postcode1, postcode2, addr1, addr2)
# highlight-start
SETTINGS disk = disk(
type=web,
endpoint='https://raw.githubusercontent.com/ClickHouse/web-tables-demo/main/web/'
);
# highlight-end
```
### Nested Dynamic Storage ### Nested Dynamic Storage
This example query shows how to use a local disk for to cache data from a table stored This example query builds on the above dynamic disk configuration and shows how to
at a URL. Neither the cache disk nor the web storage is configured in the ClickHouse use a local disk to cache data from a table stored at a URL. Neither the cache disk
configuration files; both are configured in the ATTACH query settings. nor the web storage is configured in the ClickHouse configuration files; both are
configured in the ATTACH query settings.
In the settings highlighted below notice that the disk of `type=web` is nested within In the settings highlighted below notice that the disk of `type=web` is nested within
the disk of `type=cache`. the disk of `type=cache`.