Usually one would use Redis for this problem, and you have a Redis-like system (but based on pattern matching) native to OTP, ets.
If you need a global, cluster wide counter, spawn a process with name {:global, :whatever} and let it be the source of truth for this value.
Depending on the problem, there are multiple approaches you can take. And a single Postgres instance is able to deal with massive concurrency, there might not be any need for premature optimization when SQL transaction could do.
If you need a global, cluster wide counter, spawn a process with name {:global, :whatever} and let it be the source of truth for this value.
Depending on the problem, there are multiple approaches you can take. And a single Postgres instance is able to deal with massive concurrency, there might not be any need for premature optimization when SQL transaction could do.