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)
| Column | Type | Constraints | Description |
|---|---|---|---|
| user_id | uuid | not null, references users.id | |
| subreddit_id | uuid | not null, references subreddits.id | |
| is_favorite | boolean | not null | |
| subscribed_at | timestamptz | not null |
Indexes (2)
(subreddit_id)(user_id, is_favorite)
Relationships
subreddit_subscriptions.user_idreferencesusers.idsubreddit_subscriptions.subreddit_idreferencessubreddits.id