subreddit_subscriptions table

The subreddit_subscriptions table in the Reddit Clone Database Schema schema has 4 columns, with 2 foreign keys to users and subreddits.

THE feed table. Home is a ranked union over the subreddits in this table, computed at read time. There is no feed_entries fan-out anywhere in this schema, and that is the deliberate difference from a follow-graph social network.

Columns (4)

Columns of the subreddit_subscriptions table
ColumnTypeConstraintsDescription
user_iduuidnot null, references users.id
subreddit_iduuidnot null, references subreddits.id
is_favoritebooleannot null
subscribed_attimestamptznot null

Indexes (2)

  • (subreddit_id)
  • (user_id, is_favorite)

Relationships

  • subreddit_subscriptions.user_id references users.id
  • subreddit_subscriptions.subreddit_id references subreddits.id