with alert as ( select alert_id from alerts where alert_sent_at is null ) update alerts set alert_sent_at = now() from alert returning *
Reply on news.ycombinator.com