---
title: CREATE INDEX (transaction per chunk) | Tiger Data Docs
description: Create a hypertable index using a separate transaction for each chunk
---

Since [1.3.0](https://github.com/timescale/timescaledb/releases/tag/1.3.0)

```
CREATE INDEX ... WITH (timescaledb.transaction_per_chunk, ...);
```

This option extends [`CREATE INDEX`](https://www.postgresql.org/docs/current/sql-createindex.html) with the ability to use a separate transaction for each chunk it creates an index on, instead of using a single transaction for the entire hypertable. This allows `INSERT`s, and other operations to be performed concurrently during most of the duration of the `CREATE INDEX` command. While the index is being created on an individual chunk, it functions as if a regular `CREATE INDEX` were called on that chunk, however other chunks are completely unblocked.

This version of `CREATE INDEX` can be used as an alternative to `CREATE INDEX CONCURRENTLY`, which is not currently supported on hypertables.

Warning

- Not supported for `CREATE UNIQUE INDEX`.

- If the operation fails partway through, indexes might not be created on all hypertable chunks. If this occurs, the index on the root table of the hypertable is marked as invalid. You can check this by running `\d+` on the hypertable. The index still works, and is created on new chunks, but if you want to ensure all chunks have a copy of the index, drop and recreate it.

  You can also use the following query to find all invalid indexes:

  ```
  SELECT * FROM pg_index i WHERE i.indisvalid IS FALSE;
  ```

## Samples

Create an anonymous index:

```
CREATE INDEX ON conditions(time, device_id)
    WITH (timescaledb.transaction_per_chunk);
```

Alternatively:

```
CREATE INDEX ON conditions USING brin(time, location)
    WITH (timescaledb.transaction_per_chunk);
```

## Returns

The `CREATE INDEX` command does not return a value. Upon successful completion, an index is created on the hypertable and all its chunks.
