On 2019-Sep-28, Bruce Momjian wrote:

> The CREATE INDEX docs already say:
> 
>     In a concurrent index build, the index is actually entered into
>     the system catalogs in one transaction, then two table scans occur in
>     two more transactions.  Before each table scan, the index build must
>     wait for existing transactions that have modified the table to terminate.
>     After the second scan, the index build must wait for any transactions
> --> that have a snapshot (see <xref linkend="mvcc"/>) predating the second
> --> scan to terminate.  Then finally the index can be marked ready for use,
> 
> So, having multiple concurrent index scans is just a special case of
> having to "wait for any transactions that have a snapshot", no?  I am
> not sure adding a doc mention of other index builds really is helpful.

I always thought that create index concurrently was prevented from
running concurrently in a table by the ShareUpdateExclusive lock that's
held during the operation.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Reply via email to