Re: Deadlock between concurrent index builds on different tables
Alban Hertroys <haramrae@gmail.com>
From: Alban Hertroys <haramrae@gmail.com>
To: Jeremy Finzel <finzelj@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Date: 2017-12-23T11:08:42Z
Lists: pgsql-general
> On 22 Dec 2017, at 22:53, Jeremy Finzel <finzelj@gmail.com> wrote: > > 2017-12-22 15:48:07.669 CST,"CREATE INDEX",2017-12-22 15:48:02 CST,8/32,0,ERROR,40P01,"deadlock detected","Process 4470 waits for ShareLock on virtual transaction 4/262; blocked by process 4466. > Process 4466 waits for ShareLock on virtual transaction 8/32; blocked by process 4470. > Process 4470: CREATE INDEX CONCURRENTLY index_foo_on_created_at ON foo USING btree (created_at); > Process 4466: CREATE INDEX CONCURRENTLY index_bar_on_id ON bar USING btree (id);","See server log for query details.",,,,"CREATE INDEX CONCURRENTLY index_foo_on_created_at ON foo USING btree (created_at);",,,"" If I read these logs correctly, you are creating the exact same index on foo (created_at) in both processes, which is just what you were trying to prevent doing. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.
Commits
-
Fix deadlock hazard in CREATE INDEX CONCURRENTLY
- fb7b43903e91 9.6.7 landed
- 82f1c3b7d1e0 9.5.11 landed
- 6d2a9ae0ed17 10.2 landed
- 54eff5311d7c 11.0 landed
- 47a3a1317873 9.4.16 landed