Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
798 views
in Technique[技术] by (71.8m points)

mysql - PHP forums - how to cope with unread discussions / topics / posts

I know this question has been asked here a couple of times, but none of the answers had pleased me. This is because almost all of them involve a huge read / write process related with the database, which I'd like to avoid at all cost.

About unread discussions / topics / posts, there's a lot to think of. I don't know how do forum systems like MyBB, vBulletin, Invision Power Board, Vanilla, phpBB, etc., cope with that issue, so I'd like to read from you guys your experience with that. I know that using a database table just for that is the simplest way, but that would involve a huge read / write when the community has over 10,000 members and 1000 new topics every month. It's hard, but there should be a way to avoid the server's overloading.

So, what do you find as the best practices for this issue, as well as how other forum systems cope with it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There isn't a lot of choices.

  1. mark every reader thread by each user.

    • Disadvantages: a lot of rows in very active forums
    • Advantages: Every user knows with post has read or not.
  2. mark every unread thread by each user.

    • Disadvantages: a lot of space with "unreaded" rows if there is inactivity of a lot of users
    • Solutions: add a lifetime timestamp and delete old records with a cron
    • Advantages: Every user knows with post has read or not.
  3. use timestamps to determine if show it as unread or not.

    • Disadvantages: The users don't know with are the real unread threads, the marks only show the "new trheads" since the last login
    • Advantage: Save space

The other alternative is mixing solutions, that is,

1 and 3) show thread as "unread" if they aren't older than X days and there isn't a row marked as readed for the user. The "read" rows can be deleted when they are X day older without affect anything.

Advantages

  • less spaced used to determine unread threads

Disadvantages

  • create a cron that keeps the system clean
  • Users don't know if they read threads olders than x days.

Advantages

  • Every user knows which "new posts" has read or not.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...