News for hackers. Stuff that matters.
Re:How our users exploited concurrency and how we fixed it by jessaustin on Friday January 11, 2013 @06:48PM (#5045722)
Another solution would be to have e.g. a "Completions" table indexed on user and on date. Then the RDBMS wouldn't allow duplicate goal completions for the same user and day. If you wanted to allow up to X completions/day, just add a new column to track that, and limit that column to the range [0, X). I often find that updating rows in response to transactions is a code smell. Each transaction should write one or more rows to one or more tables. Of course, if you have denormalized summary tables, they might have to update, but you only do that when you know you have to.

There are no comments on this comment yet.