开发者

Best Way to Keep Page View Count in SQL Server

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.


I guess the best way is to keep a temp table with

IMAGE_ID
IP_ADDRESS
VISIT_DATE

and a view table that keeps

IMAGE_ID
COUNTER

And batch update the view table with the details of temp table and clear the content of it periodically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜