link_previews table
The link_previews table in the Reddit Clone Database Schema schema has 10 columns, keyed by id.
The oEmbed and OpenGraph cache, keyed by a hash of the URL because the URL itself is too long to index. Two thousand posts linking the same article fetch it once.
Columns (10)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| url_hash | varchar(64) | unique, not null | |
| url | varchar(2000) | not null | |
| title | varchar(300) | ||
| description | varchar(1000) | ||
| image_url | varchar(2000) | ||
| provider_name | varchar(100) | ||
| embed_html | text | ||
| fetched_at | timestamptz | not null | |
| expires_at | timestamptz |
Indexes (1)
(expires_at)