2014-05-08 20:26
浏览 351

页面视图在Mysql中计数。 更好的方法吗?

The idea is to show how many times people have visited a certain product page.

So far I've come up with two options.

  1. Add a new column called "views" in the products table(Mysql). This seems to be the most simple and fastest way to setup.

  2. Create a new table called "product_views". Have 3 columns for it. id, product id, views. From there you can use JOINS to update and call for view count.

So what I would like to know which option is better?

图片转代码服务由CSDN问答提供 功能建议



  1. 在products表(Mysql)中添加一个名为“views”的新列。 这似乎是最简单,最快速的设置方式。

  2. 创建一个名为“product_views”的新表。 有3列。 id,产品ID,视图。 从那里你可以使用JOINS更新并调用视图计数。


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题