在 SQL Server 中保持页面视图计数的最佳方法
我将保留特定表的 PageView 计数的详细信息。
表格设计是:
[IMAGE_ID] [int] IDENTITY(1,1) NOT NULL,
[IMAGE_PATH] [nvarchar](150) NOT NULL,
[CARTOON_ID] [int] NOT NULL,
[ADD_DATE] [datetime] NOT NULL,
[ADD_USER_ID] [int] NOT NULL,
[IMAGE_TEXT] [nvarchar](max) NULL
我将在每个页面上显示这些图像,并且需要最好的方法来保持独特的页面浏览量。
你会怎么做?
请记住,该表在短时间内将包含大约 10000 张图像,并且会有大量活动。对每个请求更新此表对我来说似乎并不聪明。
I'll be keeping details of PageView counts for a specific table.
Table design is:
[IMAGE_ID] [int] IDENTITY(1,1) NOT NULL,
[IMAGE_PATH] [nvarchar](150) NOT NULL,
[CARTOON_ID] [int] NOT NULL,
[ADD_DATE] [datetime] NOT NULL,
[ADD_USER_ID] [int] NOT NULL,
[IMAGE_TEXT] [nvarchar](max) NULL
I'll be showing these images on each page and need the best way to keep the unique page view counts.
How would you do it?
Please remember that this table will have around 10000 images in short time and will a lot of activity. Updating this table on each request doesn't seem clever to me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想最好的方法是保留一个临时表
和一个视图表,
并使用临时表的详细信息批量更新视图表并定期清除其内容。
I guess the best way is to keep a temp table with
and a view table that keeps
And batch update the view table with the details of temp table and clear the content of it periodically.