In the forum module in lib.php there is the forum_print_overview function.
This function looks for new posts since the last visit of a user but if you have a forum splitted into groups a user will see the number of new posts for all groups, not only his. Which can be confusing.
The sql should take into account the group of a user and the groups in forum.