Skip to content

Support for Postgres BTree index INCLUDE (<col>, ...) #775

@theelderbeever

Description

@theelderbeever

Motivation

Postgres BTree indexex allow for an INCLUDE statement where the included columns values are stored in the leaf nodes of the index. This is an optimization to store data with the index for columns that are fetched commonly but, not necessarily filtered on.

Proposed Solutions

Index::create()
        .name(name)
        .index_type(IndexType::BTree)
        .table(table)
        .col(col)
        .include(other_cols) // postgres feature gate
        .is_unique_key();
CREATE UNIQUE INDEX an_index ON table USING BTREE (col) INCLUDE (other_cols)

Additional Information

I am unsure if this is supported on other databases.

CREATE INDEX

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions