diff --git a/sql-statements/sql-statement-add-index.md b/sql-statements/sql-statement-add-index.md index 9d4ff05c11276..0b21517e42be7 100644 --- a/sql-statements/sql-statement-add-index.md +++ b/sql-statements/sql-statement-add-index.md @@ -85,7 +85,9 @@ mysql> EXPLAIN SELECT * FROM t1 WHERE c1 = 3; ## MySQL compatibility -* `FULLTEXT`, `HASH` and `SPATIAL` indexes are not supported. +* TiDB accepts index types such as `HASH`, `BTREE` and `RTREE` in syntax for compatibility with MySQL, but ignores them. +* `SPATIAL` indexes are not supported. +* TiDB supports parsing the `FULLTEXT` syntax but does not support using the `FULLTEXT` indexes. * Descending indexes are not supported (similar to MySQL 5.7). * Adding the primary key of the `CLUSTERED` type to a table is not supported. For more details about the primary key of the `CLUSTERED` type, refer to [clustered index](/clustered-indexes.md). diff --git a/sql-statements/sql-statement-alter-table.md b/sql-statements/sql-statement-alter-table.md index a3b28c54cc46c..7747820e254b9 100644 --- a/sql-statements/sql-statement-alter-table.md +++ b/sql-statements/sql-statement-alter-table.md @@ -39,7 +39,7 @@ AlterTableSpec ::= | 'ORDER' 'BY' AlterOrderItem ( ',' AlterOrderItem )* | ( 'DISABLE' | 'ENABLE' ) 'KEYS' | ( 'MODIFY' ColumnKeywordOpt IfExists | 'CHANGE' ColumnKeywordOpt IfExists ColumnName ) ColumnDef ColumnPosition -| 'ALTER' ( ColumnKeywordOpt ColumnName ( 'SET' 'DEFAULT' ( SignedLiteral | '(' Expression ')' ) | 'DROP' 'DEFAULT' ) | 'CHECK' Identifier EnforcedOrNot | 'INDEX' Identifier IndexInvisible ) +| 'ALTER' ( ColumnKeywordOpt ColumnName ( 'SET' 'DEFAULT' ( SignedLiteral | '(' Expression ')' ) | 'DROP' 'DEFAULT' ) | 'CHECK' Identifier EnforcedOrNot | 'INDEX' Identifier ("VISIBLE" | "INVISIBLE") ) | 'RENAME' ( ( 'COLUMN' | KeyOrIndex ) Identifier 'TO' Identifier | ( 'TO' | '='? | 'AS' ) TableName ) | LockClause | AlgorithmClause diff --git a/sql-statements/sql-statement-create-index.md b/sql-statements/sql-statement-create-index.md index 57852a4a81ce2..60af78ed501e0 100644 --- a/sql-statements/sql-statement-create-index.md +++ b/sql-statements/sql-statement-create-index.md @@ -43,7 +43,7 @@ IndexOption ::= | IndexType | 'WITH' 'PARSER' Identifier | 'COMMENT' stringLit -| IndexInvisible +| ("VISIBLE" | "INVISIBLE") IndexTypeName ::= 'BTREE' @@ -349,7 +349,8 @@ The system variables associated with the `CREATE INDEX` statement are `tidb_ddl_ ## MySQL compatibility -* TiDB supports parsing the `FULLTEXT` and `SPATIAL` syntax but does not support using the `FULLTEXT`, `HASH`, and `SPATIAL` indexes. +* TiDB supports parsing the `FULLTEXT` syntax but does not support using the `FULLTEXT`, `HASH`, and `SPATIAL` indexes. +* TiDB accepts index types such as `HASH`, `BTREE` and `RTREE` in syntax for compatibility with MySQL, but ignores them. * Descending indexes are not supported (similar to MySQL 5.7). * Adding the primary key of the `CLUSTERED` type to a table is not supported. For more details about the primary key of the `CLUSTERED` type, refer to [clustered index](/clustered-indexes.md). * Expression indexes are incompatible with views. When a query is executed using a view, the expression index cannot be used at the same time. diff --git a/sql-statements/sql-statement-create-table.md b/sql-statements/sql-statement-create-table.md index cc0106328bf86..f9250151c55d3 100644 --- a/sql-statements/sql-statement-create-table.md +++ b/sql-statements/sql-statement-create-table.md @@ -76,6 +76,7 @@ KeyPart ::= IndexOption ::= 'COMMENT' String | ( 'VISIBLE' | 'INVISIBLE' ) +| ('USING' | 'TYPE') ('BTREE' | 'RTREE' | 'HASH') ForeignKeyDef ::= ( 'CONSTRAINT' Identifier )? 'FOREIGN' 'KEY' @@ -239,7 +240,8 @@ mysql> DESC t1; ## MySQL compatibility * All of the data types except spatial types are supported. -* `FULLTEXT`, `HASH` and `SPATIAL` indexes are not supported. +* TiDB accepts index types such as `HASH`, `BTREE` and `RTREE` in syntax for compatibility with MySQL, but ignores them. +* TiDB supports parsing the `FULLTEXT` syntax but does not support using the `FULLTEXT` indexes. diff --git a/sql-statements/sql-statement-show-indexes.md b/sql-statements/sql-statement-show-indexes.md index 9b1e8beef2c76..c4856b84db790 100644 --- a/sql-statements/sql-statement-show-indexes.md +++ b/sql-statements/sql-statement-show-indexes.md @@ -53,6 +53,8 @@ mysql> SHOW KEYS FROM t1; 2 rows in set (0.00 sec) ``` +Note that TiDB accepts index types such as `HASH`, `BTREE` and `RTREE` in syntax for compatibility with MySQL, but ignores them. + ## MySQL compatibility The `SHOW INDEXES [FROM|IN]` statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, [report a bug](https://docs.pingcap.com/tidb/stable/support).