perseas / Pyrseas

Provides utilities for Postgres database schema versioning.
https://perseas.github.io/
BSD 3-Clause "New" or "Revised" License
395 stars 67 forks source link

dbtoyaml create index concurrently #193

Closed fishpen0 closed 6 years ago

fishpen0 commented 6 years ago

How should I modify the indexes section of a database.yaml file to ensure when I run dbtoyaml, that pyrseas runs CREATE INDEX CONCURRENTLY instead of just CREATE INDEX

jmafc commented 6 years ago

@fishpen0 The YAML file is (more or less) a reflection of the PG catalogs, i.e., pg_index in this case. There is no indication in the catalogs whether an index can or should be created concurrently. The easiest way to get concurrent index creation may be to use a sed script, e.g., sed 's/CREATE INDEX /CREATE INDEX CONCURRENTLY /g' applied to the yamltodb SQL output before handing it over to psql. Otherwise, we would have to add a command line option or a configuration option so that yamltodb would emit CONCURRENTLY for all (or if desired, a subset of the) indexes.

jmafc commented 6 years ago

@fishpen0 Unless you want Pyrseas to add command line option as mentioned above, we will be closing this issue. Please see https://pyrseas.wordpress.com/2018/09/12/the-future-of-pyrseas-revisited/