createIndex

Creates an index on an existing column or set of columns.

Available attributes

Name Description Required for Supports
catalogName Name of the catalog all
clustered Create clustered index. all
indexName Name of the index to create firebird, hsqldb all
schemaName Name of the schema all
tableName Name of the table to add the index to all all
tablespace Tablespace to create the index in. all
unique Unique values index all

Nested properties

Name Description Required for Supports Multiple allowed
columns? / column Column(s) to add to the index

all all yes

Nested property attributes

  • name: Name of the column. It can contain the sort of direction by appending "ASC" or "DESC" to the name. Required
  • computed: boolean. set it true if the value in "name" isn't actually a column name by actually a function. Since 3.3.0.
  • descending: Allows to specify that a column should be used in descending order in the index. (i.e. ascending order) Since 3.4.

XML example

<changeSet  author="liquibase-docs"  id="createIndex-example">  
    <createIndex  catalogName="cat"  
            clustered="true"  
            indexName="idx_address"  
            schemaName="public"  
            tableName="person"  
            tablespace="A String"  
            unique="true">  
        <column  descending="true"  name="address"/>  
    </createIndex>  
</changeSet>

YAML example

changeSet:  
  id:  createIndex-example  
  author:  liquibase-docs  
  changes:  
  -  createIndex:  
      catalogName:  cat  
      clustered:  true  
      columns:  
      -  column:  
          descending:  true  
          name:  address  
      indexName:  idx_address  
      schemaName:  public  
      tableName:  person  
      tablespace:  A String  
      unique:  true

JSON example

{  "changeSet":  {  "id":  "createIndex-example",  "author":  "liquibase-docs",  "changes":  [  {  "createIndex":  {  "catalogName":  "cat",  "clustered":  true,  "columns":  [  {  "column":  {  "descending":  true,  "name":  "address"  }  }]  ,  "indexName":  "idx_address",  "schemaName":  "public",  "tableName":  "person",  "tablespace":  "A String",  "unique":  true  }  }]  }  }

SQL example

CREATE  UNIQUE  INDEX  idx_address  ON  cat.person(address  DESC);

Database support

Database Notes Auto rollback
DB2/LUW Supported Yes
DB2/z Supported Yes
Derby Supported Yes
Firebird Supported Yes
H2 Supported Yes
HyperSQL Supported Yes
INGRES Supported Yes
Informix Supported Yes
MariaDB Supported Yes
MySQL Supported Yes
Oracle Supported Yes
PostgreSQL Supported Yes
SQL Server Supported Yes
SQLite Supported Yes
Sybase Supported Yes
Sybase Anywhere Supported Yes