You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose pg-delta's concurrentIndexes option as an [experimental.pgdelta] setting #7564
supabase db schema declarative sync plans a new index as a plain CREATE INDEX, which blocks writes to the table for the whole build. pg-delta has a concurrentIndexes option that builds the index with CREATE INDEX CONCURRENTLY.
Supabase CLI 3.1.0 does not expose it. The CLI sources contain no reference to concurrentIndexes, and [experimental.pgdelta] offers only enabled, declarative_schema_path and format_options (packages/config/src/experimental.ts).
The option is in the pg-delta package that CLI 3.1.0 bundles: @supabase/pg-delta@1.0.0-alpha.60 contains it in src/plan/rules.ts and src/plan/rules/indexes.ts.
Proposed solution
[experimental.pgdelta]
concurrent_indexes = true
Default false. When it is on, generated index creates use CREATE INDEX CONCURRENTLY, and the generated file starts with -- pg-delta: transaction=false, which the CLI already honours (apps/cli/src/command-internal/migration-file.ts, lines 12–37).
Alternatives considered
Editing the generated migration by hand to add CONCURRENTLY and the directive. Regeneration overwrites the edit.
Additional context
Trade-off the setting must document: a non-transactional file is not atomic. The PostgreSQL documentation for CREATE INDEX says a concurrent build that hits a problem "will fail but leave behind an 'invalid' index", and the statements before it in the file have already committed.
pg-delta does not apply the option to partitioned parent indexes, because PostgreSQL rejects CONCURRENTLY on a partitioned parent. Those are created plainly. This is recorded in the pg-delta changelog entry for commit 52cb22a.
We have not run this option end to end through the CLI. The package contents were checked from the npm tarball, and the CLI wiring has not been exercised.
Activity