>>>>> "Andres" == Andres Freund <and...@anarazel.de> writes:
Andres> I think you'd have to instead spill the query results into a Andres> tuplestore (like we do for FOR HOLD queries at end of xact), Andres> and then do the computations based on that. The approach I've suggested to some people who wanted to look into this was to inject a window function call into the query, and teach the Limit node to be able to stop on a boolean condition (which would be based on that function result). This method should also work for WITH TIES by using a different window function. -- Andrew (irc:RhodiumToad)