Page View Counter like on StackOverFlow

后端 未结 7 1163
一向
一向 2020-12-04 20:19

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 Performanc

7条回答
  •  感动是毒
    2020-12-04 21:07

    For me the best way is to have a field in the question table and update it when the question is accessed

    UPDATE Questions SET views = views + 1 WHERE QuestionID = x
    

    Application Object: IMO is not scalable because the may end with lots of memory consumption as more questions are accessed.
    Page_views table: no need to, you have to do a costly join after

提交回复
热议问题