Much more performant row partioning.
O(n^2) -> O(n)