Postgres DISTINCT ON (user_id) paired with ORDER BY user_id, created_at DESC is still my favorite SQL feature when I just need the most recent row per user. It reads way cleaner than a window function subquery and hits a composite index in a single pass.
commit 8dc91d3