Re: Deadlock between concurrent index builds on different tables

Jeremy Finzel <finzelj@gmail.com>

From: Jeremy Finzel <finzelj@gmail.com>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Date: 2017-12-23T18:11:47Z
Lists: pgsql-general
>
>
>> Each index build needs to wait for all other transactions (Including the
> ones used by the other index build) to finish.  So I don't think a deadlock
> here is unexpected.
>
> Cheers,
>
> Jeff
>
 Does that mean I should never build more than one concurrent index at a
time within the entire cluster? If so, that is not clear from the
documentation.

So if I start 2 index builds within a second of each other, you are saying
that the first will not finish even though it started first because there
is a long transaction from the second index build? I would expect much more
deadlocks in this case, but building 5 indexes concurrently at a time of a
total 15 indexes I only get one or two deadlocks. I would expect many more
if I can’t even have 2 at once...

Thanks,
Jeremy

Commits

  1. Fix deadlock hazard in CREATE INDEX CONCURRENTLY