forJ
forJ

Reputation: 4617

Postgresql acid compliance

When concurrent update is called in several transaction at a time, is PostgreSQL still able to maintain ACID?

Say for example if I do

BEGIN
  UPDATE post SET like = like + 1
  UPDATE post SET like = like + 1
END

multiple times concurrently all at the same time, will I see ACID compliant incrementation?

I am using REPEATABLE READ transaction type.

Upvotes: 3

Views: 1671

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246463

Yes, ACID will be maintained:

  • Either both statements will succeed or none of them (atomicity).

  • No constraint will be violated (consistency).

  • The transactions will lock out each other, serialization errors reported and deadlocks resolved (isolation).

  • After COMMIT, the transaction will survive a system crash as long as the transaction logs are preserved (durability).

Upvotes: 3

Related Questions