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)

Columns of the post_rankings table
ColumnTypeConstraintsDescription
subreddit_iduuidreferences subreddits.id
sortsort_ordernot null
windowtime_windownot null
positionintegernot null
post_iduuidnot null, references posts.id
computed_attimestamptznot null

Indexes (1)

  • (post_id)

Relationships