Reorder records instead of brute forcing with transaction