Stats recount?

Viewed 112

I recently asked about importing data, and I'm happy to report that it was quite successful! We now have a substantial amount of questions, answers, and comments appearing, which is fantastic.

However, the statistics seem to be misaligned across the board.

The counts for:

  • Tags
  • Users
  • Questions asked by users
  • number of questions on a tag

are inaccurate, and the admin statistics are completely off as well.

My question is: Is there a way to force a full re-count of all statistics?

1 Answers

If there are too many questions, I recommend executing the SQL. For example, a SQL may like this.

UPDATE tag
SET question_count = ( 
SELECT COUNT(*)
FROM tag_rel
INNER JOIN question ON tag_rel.object_id = question.id
WHERE tag_rel.`status` = 1 AND tag_rel.tag_id = tag.id AND question.`status` != 10
)