I'm running into some deadlocks issues.
I have this structure
accounting
|---movements
To know the balance of the account, I usualy do a sum(movements.amount)
where accounting.id=someid
The issue is that the sum is starting to run very slow due hardware
constraints, and I can't trow more
The smoothest way to avoid deadlocks, is to ensure that all your sessions lock
their tables in exactly the same order. From your explanation, that might not
be as easy as one would expect, though.
If you can't create triggers, is it acceptable to have delayed updates on the
totals? Your idea