> [!NOTE] ![[assets/wl_lwlock_twophasestate.png|256]]
>
> | | |
> | :--- | :--- |
> | **Wait Category** | LWLock |
> | **Mechanism** | `TwoPhaseStateLock` |
> | **Operations** | [[Operations/Tuple/ModifyTable]], [[Operations/Distributed/Redistribute]] |
> | **Resources** | [[Resources/RAM|Memory]], [[Resources/CPU|CPU]] |
>
> Contention on the **Distributed Transaction Registry**. When an application uses `PREPARE TRANSACTION`, Postgres must store the transaction state (including its locks and XID) in a durable, globally accessible way so that it can be later `COMMIT PREPARED` or `ROLLBACK PREPARED`.