Comment by braiamp

Comment by braiamp 17 hours ago

2 replies

These are database locks, which means that depending which arrives first, the later transaction has to wait till the first one finishes to complete. These locks are about SQL commands and which commands can run concurrently with the others. There's a graph here of how that looks like https://pankrat.github.io/2015/django-migrations-without-dow...

Usually for maximum performance (minimum latency, maximum throughput) you want to have operations not lock each other, unless absolutely necessary, in which case you want them to be short.

whilenot-dev 17 hours ago

You make it sound like the conflict is just affecting performance and won't result in a deadlock. So it's for performance aware postgres clients/users, and not for postgres developers?

  • andyferris 15 hours ago

    It is a guide for developers using postgres as a client, who need to write systems that don't deadlock, are performant and are correct. These are the (rather sharp) tools that postgres provides for doing so (or else you can use e.g. serializable isolation and optimistic concurrency, but in my experience that has too many false positives and bail out rather eagerly, whereas these tools let you be very precise and granular).