# NullableIndex() function · @imqueue/pg-sequelize

Source: https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.nullableindex/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-sequelize 4.2.0 — generated reference, not hand-written

Declares a pair of partial indices on a nullable column, one for the rows where it is null and one for the rows where it is not.

**Signature:**

```typescript
export declare function NullableIndex(options: Partial<NullableColumnIndexOptions>): FunctionType;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| options | Partial<[NullableColumnIndexOptions](https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.nullablecolumnindexoptions/)> |  |


**Returns:**

[FunctionType](https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.functiontype/)

A property decorator, when used as a factory.

## Remarks

Two narrow indices instead of one wide one. Each covers only its half of the table, so `WHERE "col" IS NULL` and `WHERE "col" IS NOT NULL` each get an index sized to the rows they actually match — which is the point on a column where one of the two halves is much smaller than the other.

Usable bare or as a factory, exactly like [ColumnIndex](https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.columnindex/). The factory form used to build both halves from one options object that it mutated in place, and [ColumnIndex](https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.columnindex/) stores that object by reference — so both declarations ended up pointing at the same object, both saying `IS NOT NULL`, and neither carrying a predicate at all. What you got was two identical non-partial indices. It now builds a fresh options object per half, keeps a predicate of your own by combining it with the null test, and suffixes a name of your own so the two halves cannot collide.

## Example


```typescript
@Table
export class Lead extends BaseModel<Lead> {
    @NullableIndex
    @Column(DataType.DATE)
    public closedAt: Date;

    @NullableIndex({ name: 'lead_assignee', concurrently: true })
    @Column(DataType.BIGINT)
    public assigneeId: number;
}
```

