mentions table

The mentions table in the Reddit Clone Database Schema schema has 6 columns, keyed by id, with 2 foreign keys to users and subreddits.

Mentions are extracted once at write time, so the mentions tab is an index lookup instead of a text scan across every comment ever written.

Columns (6)

Columns of the mentions table
ColumnTypeConstraintsDescription
iduuidprimary key
content_typecontent_typenot null
content_iduuidnot null
mentioned_user_iduuidreferences users.id
mentioned_subreddit_iduuidreferences subreddits.id
created_attimestamptznot null

Indexes (2)

  • (mentioned_user_id, created_at)
  • (content_type, content_id)

Relationships