I've encountered this comment on reddit:

I love Postgres but the one thing I wish is had is pessimistic locking. It's just such a huge help when you need multi-statement queries when multiple sources of writes against the same data are coming in.


But then there's this:

Row-level Lock Modes

FOR UPDATE causes the rows retrieved by the SELECT statement to be locked as though for update. This prevents them from being locked, modified or deleted by other transactions until the current transaction ends.


Is that or is it not the same thing as pessimistic locking?

  • 1
    Yes, it is. Anything else? – Philᵀᴹ Nov 9 '16 at 11:46
  • 1
    The comment on reddit does not make sense to. Seems like that guy did not understand how updates work in a relational database. I think what he/she maybe meant was concurrent reads to be blocked as well when any write operation is going on – a_horse_with_no_name Nov 9 '16 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.