Add ordering to prevent occasional pgsql failures.