# Topic\_views vs Topic.views

**URL:** <https://meta.discourse.org/t/topic-views-vs-topic-views/97175>\
**Category:** Development\
**Created:** [September 14, 2018, 8:25am UTC](https://meta.discourse.org/t/topic-views-vs-topic-views/97175 "2018-09-14T08:25:31Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [December 12, 2018, 8:24pm UTC](https://meta.discourse.org/t/topic-views-vs-topic-views/97175/15 "2018-12-12T20:24:17Z")

</div>

When a member views a topic a row is INSERTed (or UPDATEd) into the topic\_user table  
[discourse/app/models/topic\_user.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/app/models/topic_user.rb)

```plaintext
# user_id :integer not null
# topic_id :integer not null
# posted :boolean default(FALSE), not null
# last_read_post_number :integer
# highest_seen_post_number :integer
# last_visited_at :datetime
# first_visited_at :datetime
# notification_level :integer default(1), not null
# notifications_changed_at :datetime
# notifications_reason_id :integer
# total_msecs_viewed :integer default(0), not null
# cleared_pinned_at :datetime
# id :integer not null, primary key
# last_emailed_post_number :integer
# liked :boolean default(FALSE)
# bookmarked :boolean default(FALSE)

```

I have a feeling it would cause a resource hit and not be a good choice as a frequently run task, but you should be able to use a count of the datetimes to get something more granular than a running total.

---

_[View the full topic](https://meta.discourse.org/t/topic-views-vs-topic-views/97175)._
