Get the latest tech news

The Slotted Counter Pattern (2020)


Handle MySQL increment counter bursts with the Slotted Counter Pattern

It is a common database pattern to increment an INT column when an event happens, such as a download or page view. You can see that this transaction has been waiting a significant amount of time to acquire a lock to increment the counter on this single row. MySQL is the main database for GitHub.com, and back in the day, when a number of PlanetScale folks worked there, we had to do this kind of counting differently.

Get the Android app

Or read this on Hacker News