Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create composite index in liquibase

How do I create a composite index using liquibase?

This is what I have so far:

    <createIndex indexName="idx_value"
                 tableName="test">
        <column name="value"/>
    </createIndex>

I have the following in mind, but I just need to confirm.

<createIndex indexName="idx_value"
             tableName="test">
    <column name="value0"/>
    <column name="value1"/>
</createIndex>
like image 283
Horace Heaven Avatar asked Jun 17 '14 00:06

Horace Heaven


People also ask

How do you create a unique index in Liquibase?

To create an index on the existing column or set of columns, follow these steps: Step 1: Add the createIndex Change Type to your changeset with the needed attributes as it is shown in the examples. Step 2: Deploy your changeset by running the update command.

What is create index concurrently?

In a concurrent index build, the index is actually entered into the system catalogs in one transaction, then two table scans occur in two more transactions. Before each table scan, the index build must wait for existing transactions that have modified the table to terminate.

What is Databasechangelog?

Liquibase uses the DATABASECHANGELOG table to track which changesets have been run. If the table does not exist in the database, Liquibase creates one automatically.

What is SQL index with example?

A SQL index is used to retrieve data from a database very fast. Indexing a table or view is, without a doubt, one of the best ways to improve the performance of queries and applications. A SQL index is a quick lookup table for finding records users need to search frequently.


1 Answers

I'd be amazed if:

<createIndex indexName="idx_value"
             tableName="test">
    <column name="value" type="varchar(255)"/>
    <column name="othercolumn" type="varchar(255)"/>
</createIndex>

didn't work...

like image 89
Craig Ringer Avatar answered Sep 17 '22 12:09

Craig Ringer