# Mysterious entries in topic\_users table

**URL:** <https://meta.discourse.org/t/mysterious-entries-in-topic-users-table/44080>\
**Category:** Bug\
**Created:** [11. Mai 2016 um 20:17 UTC](https://meta.discourse.org/t/mysterious-entries-in-topic-users-table/44080 "2016-05-11T20:17:39Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [14. Mai 2016 um 15:34 UTC](https://meta.discourse.org/t/mysterious-entries-in-topic-users-table/44080/21 "2016-05-14T15:34:20Z")

</div>

I was thinking something like

```sql
DELETE FROM topic_users
      USING topic_users tu
  LEFT JOIN users u ON u.id = tu.user_id
      WHERE u.id IS NULL
        AND topic_users.id = tu.id

```

**EDIT:** it’s pushed now 😉

[https://github.com/discourse/discourse/commit/aebb15337b2ecfa8611b7dd7616eb3528dc75e3c](https://github.com/discourse/discourse/commit/aebb15337b2ecfa8611b7dd7616eb3528dc75e3c)

---

_[View the full topic](https://meta.discourse.org/t/mysterious-entries-in-topic-users-table/44080)._
