Skip to main content
Skip to main content

system.disk_types

Description

Contains the list of disk types supported by the server, along with embedded documentation for each type. A disk type is specified in the type of a disk configuration and determines where and how a disk stores its data (local filesystem, object storage, a cache over another disk, and so on).

Note that this table lists the available disk types, whereas system.disks lists the disk instances configured on the server.

Columns

  • name (String) — The name of the disk type, as specified in the type of a disk configuration.
  • description (String) — A high-level description of what the disk type does.
  • syntax (String) — How the disk type is specified in a disk configuration.
  • examples (String) — Usage examples.
  • introduced_in (String) — The ClickHouse version in which the disk type was first introduced, in the form major.minor.
  • related (Array(String)) — The names of related disk types.

Configuration examples

A disk can be configured in two ways: statically, in the server configuration files (XML or YAML), or dynamically, in the settings of a CREATE/ATTACH query using the disk function. The same disk type and parameters are accepted in both cases.

Static configuration

Disks are defined under storage_configuration in the server configuration. The following example defines an s3 disk and a storage policy that uses it.

<clickhouse>
    <storage_configuration>
        <disks>
            <s3_disk>
                <type>s3</type>
                <endpoint>https://s3.eu-west-1.amazonaws.com/clickhouse-eu-west-1.clickhouse.com/data/</endpoint>
                <use_environment_credentials>1</use_environment_credentials>
            </s3_disk>
        </disks>
        <policies>
            <s3_policy>
                <volumes>
                    <main>
                        <disk>s3_disk</disk>
                    </main>
                </volumes>
            </s3_policy>
        </policies>
    </storage_configuration>
</clickhouse>

The same configuration in YAML:

storage_configuration:
  disks:
    s3_disk:
      type: s3
      endpoint: https://s3.eu-west-1.amazonaws.com/clickhouse-eu-west-1.clickhouse.com/data/
      use_environment_credentials: 1
  policies:
    s3_policy:
      volumes:
        main:
          disk: s3_disk

A table can then use the disk through its storage policy:

CREATE TABLE test (a Int32, b String)
ENGINE = MergeTree() ORDER BY a
SETTINGS storage_policy = 's3_policy';

Dynamic configuration

A disk can also be defined directly in the settings of a CREATE/ATTACH query, without a predefined disk in the configuration files, using the disk function:

CREATE TABLE test (a Int32, b String)
ENGINE = MergeTree() ORDER BY a
SETTINGS disk = disk(
    type = s3,
    endpoint = 'https://s3.eu-west-1.amazonaws.com/clickhouse-eu-west-1.clickhouse.com/data/',
    use_environment_credentials = 1
);

See Configuring external storage for the full list of parameters of each disk type.

Example

SELECT name, description
FROM system.disk_types
WHERE name IN ('local', 'object_storage')
ORDER BY name

See also