post_rankings table
The post_rankings table in the Reddit Clone Database Schema schema has 6 columns, with 2 foreign keys to subreddits and posts.
Precomputed listing slices for the expensive combinations - top of the year, all time, and r/all - refreshed on a schedule. subreddit_id null IS the site-wide front page. Cheap sorts read the score columns on posts directly and never touch this table.
Columns (6)
| Column | Type | Constraints | Description |
|---|---|---|---|
| subreddit_id | uuid | references subreddits.id | |
| sort | sort_order | not null | |
| window | time_window | not null | |
| position | integer | not null | |
| post_id | uuid | not null, references posts.id | |
| computed_at | timestamptz | not null |
Indexes (1)
(post_id)
Relationships
post_rankings.subreddit_idreferencessubreddits.idpost_rankings.post_idreferencesposts.id