Answer the question
In order to leave comments, you need to log in
Unread messages and comments
Hello everyone,
First of all, I congratulate everyone on the Upcoming/Upcoming!
The question is as follows: When displaying messages, it is required to mark new (messages) with special icons, as is done on lj, habr, etc.
From more or less small bicycles, it comes to mind to bind to the viewing time:
There is a condition:
если ( ДатаПоследнегоПосещения < ДатаПоследнегоКомментария )
то { пометить маркой все комментарии с датой больше ДатаПоследнегоПосещения и обновить ДатаПоследнегоПосещения }
Answer the question
In order to leave comments, you need to log in
What else can you think of? Select all messages related to the desired topic and with a time older than the last time the user was active in this topic (or on the site in general). With a normal data model, with indexes, everything will work.
And you know, the “number of records in the database” depends on the tasks - for someone, 100,000 is already a lot, and for another, even 10 million is normal. Few details...
can be optimized as follows: by default, we consider all posts to be fully read, but when a post is created, set the reading time for all users = current. and every day to clean out all such records that are older than, say, a year. then, with 500 users and 150 posts per year, we get no more than 75,000 records at a time. when visiting the record, of course we update / add, but these are trifles.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question