Sometimes every row belongs in the report. Add NULLS LAST to a sort column to place missing values after all recorded values. A second sort column orders rows that share a time or both lack one.
SELECT id, retries FROM deployments
ORDER BY retries DESC NULLS LAST, id ASC;For every staging deployment, show id and finished_at. Put the latest finish first and the missing times last. Within each tie use ascending ID.