This blocks writes to all partitions until commit: postgres=# begin; CREATE INDEX ON pt(i); BEGIN CREATE INDEX
Compare with CLUSTER rel1, rel2, ..., and REINDEX {SCHEMA|DATABASE|SYSTEM}, which release their locks as soon as each rel is processed. I noticed while implementing REINDEX for partitioned tables, which, it seems clear, should also avoid slowly accumulating more and more write locks across an entire partition heirarchy. -- Justin