Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PostgreSQL] New feature - Consider partial Index #494

Open
jullierme opened this issue Jan 17, 2024 · 0 comments
Open

[PostgreSQL] New feature - Consider partial Index #494

jullierme opened this issue Jan 17, 2024 · 0 comments

Comments

@jullierme
Copy link

Please, consider partial Index (PostgreSQL)

A partial index is an index built over a subset of a table; the subset is defined by a conditional expression (called the predicate of the partial index). The index contains entries only for those table rows that satisfy the predicate.

SQL example

CREATE TABLE tests (
    subject text,
    target text,
    success boolean,
    ...
);

CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
    WHERE success is true;

Suggestion:

table test {
    subject text
    target text
    success boolean

    Indexes {
      (subject, target) [name: 'tests_success_constraint', unique, expression: `success is true`]
    }
}

Important note:

There is already a perfect comment from Yokozuna59 here issue 68 that could solve this one graciously

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant