Well, that's a very different approach now as a result of our discussion.
As of partial EXECUTE, it's point (3) in my plan. But it buys us only fast cancel and I am really not sure I understand all the consequences (e.g. transaction handling), so I don't think I will be doing it.
As of "next query fetching remaining results" and "thread pool", I've incorporated it into my plan as point 2. Basically, there are next modes:
1) (And it's the only mode now until after p.2 is implemented) - swapping to temp file is done on query execute time as before. The only change is that it's not loading to memory, but copies to a temp file, so no OOMs anymore.
2) Client-supplied executor
3) System-global cachedExecutor
4) Deferred swapping in the same thread much like in the first patch.
So, it's up for user to decide. The question is which mode (1,3 or 4) should be default.
Best regards, Vitalii Tymchyshyn