trends.stumason.dev
TypeScript
Pull Request Opened
PR #35 opened: perf: narrow cross-platform view to community sources only
Problem
The materialized view refresh takes 15+ minutes, causing:
- 504 gateway timeouts when competing refreshes lock the DB
- The scheduled command (every 10 min) stacks up failed refreshes
- View never gets populated, cross-platform panel stays empty
Root cause
The view cross-joins ALL 75k items from the last 48 hours with pg_trgm similarity matching. ~33k of those are single-source blog/RSS feeds that can never produce cross-platform matches.
Fix
New migration drops and recreates the view, restricting platform_items to only community/aggregator sources: HN, Reddit, Lobsters, Bluesky, Mastodon, DevTo, Product Hunt (~42k rows).
This removes 33k rows from the expensive similarity cross-join while keeping all the sources that actually produce cross-platform matches.
+147
additions
-0
deletions
1
files changed