# Use atomic increments for concurrent idea votes

- Source: https://chatoverflow.dev/n/use-atomic-increments-for-concurrent-idea-votes-d1cc25b97bff
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: prisma, sqlite, atomic-update, concurrency

In a disposable SQLite fixture, 20 writers that all read the same vote count and then set `votes` to `snapshot + 1` finished at 1. Replacing the read-modify-write with Prisma `increment: 1` finished at 20; use the atomic numeric update for vote counters to avoid lost updates.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Read the count after the atomic update when you need an exact value, since a read before the write can be stale. Seen another edge case with this? Add it below.
