diff options
author | bazeltsev <bazeltsev@yandex-team.ru> | 2022-06-20 12:23:06 +0300 |
---|---|---|
committer | bazeltsev <bazeltsev@yandex-team.ru> | 2022-06-20 12:23:06 +0300 |
commit | 00ae0f67924bfeae3acee7233c9c51d40aac3a68 (patch) | |
tree | b8e904f1f30d6fc5b7da338168cbf76466e598e8 | |
parent | f2606071b410041b6c5aa55093335d7079085784 (diff) | |
download | ydb-00ae0f67924bfeae3acee7233c9c51d40aac3a68.tar.gz |
Move AST
updated
ref:331b8b57708c644cb1dd983777bbe7aebc8d3a42
7 files changed, 33 insertions, 9 deletions
diff --git a/ydb/docs/en/core/reference/ydb-cli/commands/_includes/secondary_index.md b/ydb/docs/en/core/reference/ydb-cli/commands/_includes/secondary_index.md index 97a3715440..84a59054a1 100644 --- a/ydb/docs/en/core/reference/ydb-cli/commands/_includes/secondary_index.md +++ b/ydb/docs/en/core/reference/ydb-cli/commands/_includes/secondary_index.md @@ -8,7 +8,7 @@ The `table index` command lets you create and delete [secondary indexes](../../. {% include [conn_options_ref.md](conn_options_ref.md) %} -For information about the purpose and use of secondary indexes for app development, see [Secondary indexes](../../../../best_practices/schema_design.md) in the "Recommendations" section. +For information about the purpose and use of secondary indexes for app development, see [Secondary indexes](../../../../best_practices/secondary_indexes.md) in the "Recommendations" section. ## Creating a secondary index {#add} diff --git a/ydb/docs/ru/core/concepts/_includes/secondary_indexes.md b/ydb/docs/ru/core/concepts/_includes/secondary_indexes.md index d1d931ac1a..ae03b53bca 100644 --- a/ydb/docs/ru/core/concepts/_includes/secondary_indexes.md +++ b/ydb/docs/ru/core/concepts/_includes/secondary_indexes.md @@ -50,10 +50,10 @@ Вторичный индекс может быть: -- Создан при создании таблицы командой YQL [`CREATE TABLE`](../../yql/reference/syntax/create_table.md). -- Добавлен к существующей таблице командой YQL [`ALTER TABLE`](../../yql/reference/syntax/alter_table.md) или командой YDB CLI [`table index add`](../../reference/ydb-cli/commands/secondary_index.md#add) -- Удален у существующей таблицы командой YQL [`ALTER TABLE`](../../yql/reference/syntax/alter_table.md) или командой YDB CLI [`table index drop`](../../reference/ydb-cli/commands/secondary_index.md#drop). -- Удален вместе с таблицей командой YQL [`DROP TABLE`](../../yql/reference/syntax/drop_table.md) или командой YDB CLI `table drop`. +- Создан при создании таблицы командой YQL [CREATE TABLE](../../yql/reference/syntax/create_table.md). +- Добавлен к существующей таблице командой YQL [ALTER TABLE](../../yql/reference/syntax/alter_table.md) или командой YDB CLI [table index add](../../reference/ydb-cli/commands/secondary_index.md#add) +- Удален у существующей таблицы командой YQL [ALTER TABLE](../../yql/reference/syntax/alter_table.md) или командой YDB CLI [table index drop](../../reference/ydb-cli/commands/secondary_index.md#drop). +- Удален вместе с таблицей командой YQL [DROP TABLE](../../yql/reference/syntax/drop_table.md) или командой YDB CLI `table drop`. ## Назначение и применение вторичных индексов {#best_practices} diff --git a/ydb/docs/ru/core/reference/ydb-cli/commands/_includes/explain-plan/intro.md b/ydb/docs/ru/core/reference/ydb-cli/commands/_includes/explain-plan/intro.md index a027b737d4..1cc9dd9781 100644 --- a/ydb/docs/ru/core/reference/ydb-cli/commands/_includes/explain-plan/intro.md +++ b/ydb/docs/ru/core/reference/ydb-cli/commands/_includes/explain-plan/intro.md @@ -1,5 +1,3 @@ -# Получение плана запроса - Получите план запроса: ```bash diff --git a/ydb/docs/ru/core/reference/ydb-cli/commands/_includes/secondary_index.md b/ydb/docs/ru/core/reference/ydb-cli/commands/_includes/secondary_index.md index c54c87a7e6..aad699555d 100644 --- a/ydb/docs/ru/core/reference/ydb-cli/commands/_includes/secondary_index.md +++ b/ydb/docs/ru/core/reference/ydb-cli/commands/_includes/secondary_index.md @@ -8,7 +8,9 @@ {% include [conn_options_ref.md](conn_options_ref.md) %} -О назначении и применении вторичных индексов при разработке приложений можно прочитать в статье [Вторичные индексы](../../../../best_practices/schema_design.md) в разделе "Рекомендации". +Также добавить или удалить вторичный индекс можно с помощью директив [ADD INDEX и DROP INDEX](../../../../yql/reference/syntax/alter_table.md#secondary-index) операции YQL ALTER TABLE. + +О назначении и применении вторичных индексов при разработке приложений можно прочитать в статье [Вторичные индексы](../../../../best_practices/secondary_indexes.md) в разделе "Рекомендации". ## Создание вторичного индекса {#add} diff --git a/ydb/docs/ru/core/reference/ydb-cli/commands/explain-plan.md b/ydb/docs/ru/core/reference/ydb-cli/commands/explain-plan.md index 66a94e20c1..b5e667ef01 100644 --- a/ydb/docs/ru/core/reference/ydb-cli/commands/explain-plan.md +++ b/ydb/docs/ru/core/reference/ydb-cli/commands/explain-plan.md @@ -1,7 +1,27 @@ +# Получение плана исполнения запроса и AST + +Чтобы лучше понимать работу запросов, вы можете получить и проанализировать план запроса. Дополнительно к плану запроса вы можете получить AST (абстрактное синтаксическое дерево). Раздел AST содержит представление на внутреннем языке miniKQL. + +## Получите плана запроса {#explain-plan} + {% include [intro.md](_includes/explain-plan/intro.md) %} {% include [intro-exp.md](_includes/explain-plan/intro-exp.md) %} +## Получите AST {#ast} + +Для получения AST добавьте в конце команды флаг `--ast`: + +```bash +ydb -e grpcs://<эндпоинт> -d <база данных> \ +table query explain -q "SELECT season_id, episode_id, title \ +FROM episodes \ +WHERE series_id = 1 AND season_id > 1 \ +ORDER BY season_id, episode_id LIMIT 3" --ast +``` + +В результате дополнительно отобразится AST запроса. + {% include [examples.md](_includes/explain-plan/examples.md) %} {% include [examples-exp.md](_includes/explain-plan/examples-exp.md) %} diff --git a/ydb/docs/ru/core/reference/ydb-cli/toc_i.yaml b/ydb/docs/ru/core/reference/ydb-cli/toc_i.yaml index d95f5d2b19..214423b452 100644 --- a/ydb/docs/ru/core/reference/ydb-cli/toc_i.yaml +++ b/ydb/docs/ru/core/reference/ydb-cli/toc_i.yaml @@ -25,7 +25,7 @@ items: items: - name: Выполнение запроса к данным href: commands/query.md - - name: План исполнения запроса + - name: Получение плана исполнения запроса и AST href: commands/explain-plan.md - name: Потоковое чтение таблицы href: commands/readtable.md diff --git a/ydb/docs/ru/core/yql/reference/yql-core/syntax/_includes/alter_table.md b/ydb/docs/ru/core/yql/reference/yql-core/syntax/_includes/alter_table.md index 2c7fe12cfd..36b6790959 100644 --- a/ydb/docs/ru/core/yql/reference/yql-core/syntax/_includes/alter_table.md +++ b/ydb/docs/ru/core/yql/reference/yql-core/syntax/_includes/alter_table.md @@ -25,6 +25,7 @@ ALTER TABLE episodes DROP column is_deleted; ``` {% if feature_secondary_index %} + ## Добавление или удаление вторичного индекса {#secondary-index} ```ADD INDEX``` — добавляет индекс с указанным именем и типом для заданного набора колонок. Приведенный ниже код добавит глобальный индекс с именем ```title_index``` для колонки ```title```. @@ -42,6 +43,9 @@ ALTER TABLE `series` ADD INDEX `title_index` GLOBAL ON (`title`); ```sql ALTER TABLE `series` DROP INDEX `title_index`; ``` + +Также добавить или удалить вторичный индекс можно с помощью команды [table index](https://ydb.tech/ru/docs/reference/ydb-cli/commands/secondary_index) {{ ydb-short-name }} CLI. + {% endif %} {% if feature_changefeed %} |