In a non-streaming db What would prevent you from storing the result set and just using the last iteration to calculate the next?
A big part of materializing datasets for performance is finding the right grain that is both easy enough to calculate and also can do nice things like be resumeable for snapshots.