Ordering by checkpoint in queries