Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support CONCURRENTLY for creating large indexes #59

@Skowt

Description

@Skowt

We've got an issue with new index migrations where we have to run them with CREATE INDEX CONCURRENTLY to avoid locking our busiest tables. However when we do this, rambler is unable to apply the migrations because we get errors like:

17:33 info  1 migrations to apply
17:33 info  applying 202505211135_add_field_to_table.sql
unable to apply migration 202505211135_add_field_to_table.sql: pq: CREATE INDEX CONCURRENTLY cannot run inside a transaction block

CREATE INDEX CONCURRENTLY IF NOT EXISTS field_index_idx ON table(column_1, column_2);

Is there a workaround for this (apart from applying the index manually and then merging in the migrations into our repo?) - We have migrations run automatically during our deployment flow which is why we've got IF NOT EXISTS to allow migrations to be run both manually and via CI/CD when needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions