MergeTree table engine

## Column-level settings[​](#column-level-settings "Direct link to Column-level settings")

Certain MergeTree settings can be overridden at column level:

- `max_compress_block_size` — Maximum size of blocks of uncompressed data before compressing for writing to a table.
- `min_compress_block_size` — Minimum size of blocks of uncompressed data required for compression when writing the next mark.

Example:

```
CREATE TABLE tab
(
    id Int64,
    document String SETTINGS (min_compress_block_size = 16777216, max_compress_block_size = 16777216)
)
ENGINE = MergeTree
ORDER BY id
```

Column-level settings can be modified or removed using [ALTER MODIFY COLUMN](/docs/sql-reference/statements/alter/column), for example:

- Remove `SETTINGS` from column declaration:

```
ALTER TABLE tab MODIFY COLUMN document REMOVE SETTINGS;
```

- Modify a setting:

```
ALTER TABLE tab MODIFY COLUMN document MODIFY SETTING min_compress_block_size = 8192;
```

- Reset one or more settings, also removes the setting declaration in the column expression of the table's CREATE query.

```
ALTER TABLE tab MODIFY COLUMN document RESET SETTING min_compress_block_size;
```

- [Creating tables](#table_engine-mergetree-creating-a-table)
  - [Query clauses](#mergetree-query-clauses)- [Data storage](#mergetree-data-storage)- [Primary Keys and Indexes in Queries](#primary-keys-and-indexes-in-queries)
      - [Selecting a primary key](#selecting-a-primary-key)- [Choosing a primary key that differs from the sorting key](#choosing-a-primary-key-that-differs-from-the-sorting-key)- [Use of indexes and partitions in queries](#use-of-indexes-and-partitions-in-queries)- [Use of index for deterministic expressions in primary keys](#use-of-index-for-deterministic-expressions-in-primary-keys)- [Use of index for partially-monotonic primary keys](#use-of-index-for-partially-monotonic-primary-keys)- [Data skipping indexes](#table_engine-mergetree-data_skipping-indexes)- [Skip Index Types](#skip-index-types)- [Text index](#text)- [Functions support](#functions-support)- [Projections](#projections)
        - [Projection query](#projection-query)- [Projection indexes](#projection-index)- [Projection storage](#projection-storage)- [Query analysis](#projection-query-analysis)- [Concurrent data access](#concurrent-data-access)- [TTL for columns and tables](#table_engine-mergetree-ttl)
            - [Column TTL](#mergetree-column-ttl)- [Table TTL](#mergetree-table-ttl)- [Removing expired data](#mergetree-removing-expired-data)- [Disk types](#disk-types)- [Using multiple block devices for data storage](#table_engine-mergetree-multiple-volumes)
                - [Introduction](#introduction)- [Terms](#terms)- [Configuration](#table_engine-mergetree-multiple-volumes_configure)- [Details](#details)- [Using external storage for data storage](#table_engine-mergetree-s3)
                  - [Using S3 disks with multiple volumes](#s3-multiple-volumes)- [Virtual columns](#virtual-columns)- [Column statistics](#column-statistics)
                      - [Available types of column statistics](#available-types-of-column-statistics)- [Supported data types](#supported-data-types)- [Supported operations](#supported-operations)- [Column-level settings](#column-level-settings)

Was this page helpful?