The topic view data that is displayed in the UI comes from the
views column of the
topics table. The
views column is incremented once per
topic_id every 8 hours. The 8 hour period can be changed by overriding the default value of the
topic_view_duration_hours site setting.
topic_views table only gets a single entry per
ip_address. If a user views a topic multiple times, there will only be a single entry for them for the topic in the
topic_views table. The data from this table is used internally by Discourse to check if a user has met the trust level 3 requirements for topics entered.
You can test this yourself by running the following query with a
:topic_id from your site:
COUNT(user_id) AS views_per_user
WHERE topic_id = :topic_id
GROUP BY user_id
ORDER BY views_per_user DESC
You’ll see that
views_per_user is always 1. This means that you can expect
topics.views to return a higher value than the sum of
topic_views for a particular topic ID.