Deadline statistics gathering with Postgres