News for hackers. Stuff that matters.
Re:PostgreSQL anti-patterns: read-modify-write cycles (2014) by dalore on Wednesday December 21, 2016 @10:18AM (#13229745)
Another solution would be to have a view that calculates the balance from the transactions.

Then your sql code can check the balance without doing a sum (which might get expensive, and often the same value until a transaction changes it) just by joining to that view.

i.e. `WHERE total_view.balance > 0`

There are no comments on this comment yet.