Gulcin Yildirim Jelinek takes us through locking in PostgreSQL:
All locking, whatever their type is, will reduce the throughput, and potentially increase the latency, which means a loss of performance, as nothing is ever free. If my intention is to make sure my data does not have corruption and everyone is getting a correct result at their time of query, I have to agree that I’d have to lock access when multiple transactions are targeting the same table or same row to make sure we take some time to keep the order of things instead of showing wrong results, fast.
Read on for a quick primer on multi-version concurrency control, locking, and lock mechanisms in PostgreSQL.