站内消息的性能问题
我想给所有的会员发送站内消息,但是由于会员过多我在点发送的时候对数据库的符合太重了(大概同时对一个表添加了200万左右条记录)。请问有什么好的解决方案吗 问题点数:100、回复次数:5Top
1 楼roapzone(宗璞))回复于 2005-04-03 21:52:17 得分 10
你用的什么数据库?如果支持存储过程尽量用!
把数据层写成一个独立类!
Top
2 楼saintqiqi(钻石星辰(www.saintzone.net))回复于 2005-04-03 21:54:21 得分 0
200万!!
顶Top
3 楼cnhgj(戏子) (没时间练太极)回复于 2005-04-03 22:08:50 得分 30
应该做个公共消息的表,所有会员去读,而不是给所有会员发消息!Top
4 楼dilu1984(清)回复于 2005-04-03 22:31:09 得分 0
所有会员去读怎么判断消息是否已读呢Top
5 楼saucer(思归)回复于 2005-04-04 05:12:50 得分 60
agree with 戏子, use pull method, it is a trade-off
>>>所有会员去读怎么判断消息是否已读呢
add another table, :-)
CommonMessage
messageid int
message nvarchar(1000)
UserMessage -- record whether the user has read the message
uid int
messageid int
select * from CommonMessage where messageid not in (select messageid from UserMessage where uid=@uid)
after the user read the message, insert an entry to the UserMessage table, but remember to delete the entry if you ever delete the messageTop




