Page View Counter like on StackOverFlow
asp.net
Solution
The counter i optimized works like this:
UPDATE page_views SET counter = counter + 1 WHERE page_id = x
if (affected_rows == 0 ) {
INSERT INTO page_views (page_id, counter) VALUES (x, 1)
}
This way you run 2 query for the first view, the other views require only 1 query.
Problem
What is the best way to implement the page view counter like the ones they have here on the site where each question has a "Views" counter? Factoring in Performance and Scalability issues.