You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ko...@apache.org on 2022/09/05 18:28:42 UTC

[ignite-3] branch main updated: IGNITE-17505 Add documentation for INDEX commands (#1025)

This is an automated email from the ASF dual-hosted git repository.

korlov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 9fd2b5ab1b IGNITE-17505 Add documentation for INDEX commands (#1025)
9fd2b5ab1b is described below

commit 9fd2b5ab1bb09f8c4d04bc50b944b2b4477cd590
Author: IgGusev <de...@mail.ru>
AuthorDate: Mon Sep 5 22:28:38 2022 +0400

    IGNITE-17505 Add documentation for INDEX commands (#1025)
---
 docs/_docs/sql-reference/ddl.adoc | 71 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 1 deletion(-)

diff --git a/docs/_docs/sql-reference/ddl.adoc b/docs/_docs/sql-reference/ddl.adoc
index dca9514813..8a813d6059 100644
--- a/docs/_docs/sql-reference/ddl.adoc
+++ b/docs/_docs/sql-reference/ddl.adoc
@@ -245,6 +245,60 @@ Drop Person table if the one exists:
 DROP TABLE IF EXISTS "Person";
 ----
 
+== CREATE INDEX
+
+Creates a new index.
+
+[source,sql]
+----
+CREATE INDEX [IF NOT EXISTS] name ON tableName
+[USING { HASH | TREE }]
+(column_definition [, column_definition]...);
+----
+
+Parameters:
+
+
+* `name` - name of the index.
+* `tableName` - name of the table to create the index on.
+* `IF NOT EXISTS` - create the index only if an index with the same name does not exist.
+* `USING` - specifies whether the command creates a sorted index or a hash index. Possible values: `HASH`, `TREE`.
+
+
+//NOTE: Add image
+
+Examples:
+
+Create index Persons for Person table:
+
+[source,sql]
+----
+CREATE INDEX IF NOT EXISTS Persons ON Person (column1)
+----
+
+== DROP INDEX
+
+[source,sql]
+----
+DROP INDEX [IF EXISTS] indexName;
+----
+
+Parameters:
+
+- indexName - the name of the index.
+- `IF EXISTS` - do not throw an error if an index with the specified name does not exist.
+
+
+
+Examples:
+
+Drop index if the one exists:
+
+[source,sql]
+----
+DROP INDEX IF EXISTS Persons;
+----
+
 = Grammar Reference
 
 == column_definition_or_list
@@ -289,6 +343,21 @@ Referenced by:
 * link:sql-reference/ddl#alter-table[ALTER TABLE]
 * link:sql-reference/ddl#drop-table[DROP TABLE]
 
+== column_definition
+//NOTE: Replace code with image
+
+```
+column_name [ASC | DESC] [NULLS {FIRST | LAST}]
+```
+
+Parameters:
+
+* `ASC` or `DESC` - specifies that the column should be sorted in an ascending or descending order respectively.
+* `NULLS` - specifies whether null values will be at the start or at the end of the index. Possible values: `FIRST`, `LAST`.
+
+Referenced by:
+
+* link:sql-reference/ddl#сreate-index[CREATE INDEX]
 
 = System Functions
 
@@ -305,4 +374,4 @@ CREATE TABLE t (id varchar default gen_random_uuid primary key, val int)
 
 Referenced by:
 
-* link:sql-reference/ddl#create-table[CREATE TABLE]
\ No newline at end of file
+* link:sql-reference/ddl#create-table[CREATE TABLE]