云数据库 GAUSSDB-CREATE INDEX:语法格式

时间:2024-11-13 14:46:10

语法格式

  • 在表上创建索引。
    CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ IF NOT EXISTS ] [ [schema_name.] index_name ] ON table_name [ USING method ]
        ({ { column_name [ ( length ) ] | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] }[, ...] )
        [ INCLUDE ( column_name [, ...] ) ]
        [ WITH ( {storage_parameter = value} [, ... ] ) ]
        [ TABLESPACE tablespace_name ]
        { [ COMMENT 'string' ] [ ... ] }
        [ { VISIBLE | INVISIBLE } ]
        [ WHERE predicate ];
  • 在分区表上创建索引。
    CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [schema_name.] index_name ] ON table_name [ USING method ]
        ( { { column_name [ ( length ) ] | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS LAST ] } [, ...] )
        [ LOCAL
            [ ( { PARTITION index_partition_name [ FOR { partition_name | ( partition_value [, ...] ) } ] [ TABLESPACE index_partition_tablespace ]
                    [ ( [SUBPARTITION index_subpartition_name] [ FOR { partition_name | ( partition_value [, ...] ) } ]  [ TABLESPACE index_partition_tablespace ]
                        [, ...] ) ]
                [, ...] } ) ]
            | GLOBAL ]
        [ INCLUDE ( column_name [, ...] ) ]
        [ WITH ( { storage_parameter = value } [, ...] ) ]
        [ TABLESPACE tablespace_name ]
        { [ COMMENT 'string' ] [ ... ] }
        [ { VISIBLE | INVISIBLE } ];
support.huaweicloud.com/centralized-devg-v8-gaussdb/gaussdb-42-0552.html