3 ms·
The number of times I've had to increment a value by one are minimal. Or similar things where you want to update one value based on the other values, and do it
by jrochkind1 7y ago
The number of times I've had to increment a value by one are minimal. Or similar things where you want to update one value based on the other values, and do it in an atomic way.
But if I had to increment specifically, and were using ActiveRecord... I'd use the ActiveRecord increment! method. Which has the proper db-atomicity semantics you want, it does execute `UPDATE x SET n = n+1 WHERE pk = y ...`