Transaction lock granting order

From: Joshua Ma <josh(at)benchling(dot)com>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Transaction lock granting order
Date: 2016-12-05 19:33:46
Message-ID: CAG9XPV=YAj0W1onOAt5PW5Yjbv3KwjD+xgw8OuGLGc1C0rVaog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can someone point me to documentation on (or confirm) this detail on
Postgres locking?

- Transaction X starts and acquires a lock on a table T
- Transaction Y starts and attempts to acquire a conflicting lock on T - it
is now blocked
- Transaction Z starts and also attempts to acquire a conflicting lock on T
- it is now blocked

Is txn Y guaranteed to be the first txn to proceed once X finishes? Is
there some "lock queue order" that is respected? Is there any chance Z can
proceed before Y, say if it acquires a less aggressive lock?

Put differently: when txn Y starts, it has to wait. Is this wait time at
most the length of the longest txn older than Y?

Thanks,
Josh

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-12-05 20:33:44 Re: Transaction lock granting order
Previous Message Jeff Janes 2016-12-05 19:02:37 Re: INSERT - UPDATE throughput oscillating and SSD activity after stopping the client