---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://ydb-platform--ydb.viewer.diplodoc.com/en/yql/reference/syntax/create_table/min_max_index.md
  - https://ydb-platform--ydb.viewer.diplodoc.com/ru/yql/reference/syntax/create_table/min_max_index.md
  - href: https://ydb-platform--ydb.viewer.diplodoc.com/en/yql/reference/syntax/create_table/min_max_index.md
    type: text/markdown
    title: Markdown version
  - href: https://ydb-platform--ydb.viewer.diplodoc.com/en/llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/core/yql/reference/syntax/create_table/min_max_index.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb-platform--ydb.viewer.diplodoc.com/en/llms.txt

# min_max index

 [min-max index](https://ydb-platform--ydb.viewer.diplodoc.com/en/dev/min_max-skip-index.md) is a [local index](https://ydb-platform--ydb.viewer.diplodoc.com/en/concepts/glossary.md#local-index) that can only be specified with the `LOCAL` keyword. When creating a table, the `min_max` type is used in the `INDEX` section (similar to a [secondary index](https://ydb-platform--ydb.viewer.diplodoc.com/en/yql/reference/syntax/create_table/secondary_index.md), but with a mandatory `LOCAL` and corresponding `USING`). See also [local indexes](https://ydb-platform--ydb.viewer.diplodoc.com/en/concepts/query_execution/local_indexes.md).


```yql
CREATE TABLE `<table_name>` (
    ...
    INDEX `<index_name>`
        LOCAL
        USING min_max
        ON ( <index_column> )
    [,   ...]
)
```


Where:

* `<index_name>` — index name.
* `LOCAL` — required keyword for the min_max index.
* `<index_column>` — the column on which the index is built. You must specify exactly one column.
* For the min_max index, covering columns (`COVER (...)`) and additional data columns are not supported.

`WITH (...)` parameters:

<!-- source: en/yql/reference/syntax/_includes/min_max_index_parameters.md -->
The min_max index has no specific parameters `WITH (...)`.
<!-- endsource: en/yql/reference/syntax/_includes/min_max_index_parameters.md -->

Creating a min_max index for an existing table is described in the [`ALTER TABLE ADD INDEX`](https://ydb-platform--ydb.viewer.diplodoc.com/en/yql/reference/syntax/alter_table/indexes.md#local-min-max) section.

## Example {#example}


```yql
CREATE TABLE events (
    id Uint64,
    created_at Timestamp,
    level Int32,
    PRIMARY KEY (id),
    INDEX idx_created_at LOCAL USING min_max
        ON (created_at),
    INDEX idx_level LOCAL USING min_max
        ON (level)
)
WITH (
    STORE = COLUMN
);
```
