Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Maybe another idea is that the reindexing is staged: the user would
> first run a command to create the replacement index, and leave both
> present until the user runs a second command (which acquires a strong
> lock) that executes the switch. Somehow similar to a constraint created
> as NOT VALID (which runs without a strong lock) which can be later
> validated separately.
Yeah. We could consider
CREATE INDEX CONCURRENTLY (already exists)
SWAP INDEXES (requires ex-lock, swaps names and constraint dependencies; or maybe just implement as swap of
relfilenodes?)
DROP INDEX CONCURRENTLY
The last might have some usefulness in its own right, anyway.
regards, tom lane