Deadlocks and parallel queries

Worker processes can acquire only shared locks, but they can still be involved in deadlocks with processes that acquire exclusive locks. The locks they hold meet one or more of these conditions:

A single worker process can be involved in a deadlock such as those between two serial processes. For example, a worker process that is performing a join between two tables can deadlock with a serial process that is updating the same two tables.

In some cases, deadlocks between serial processes and families involve a level of indirection.

For example, if a task holds an exclusive lock on tableA and needs a lock on tableB, but a worker process holds a family-duration lock on tableB, the task must wait until the transaction that the worker process is involved in completes.

If another worker process in the same family needs a lock on tableA, the result is a deadlock. Figure 12-1 illustrates the following deadlock scenario:

These are the steps that lead to the deadlock: