Swift-Kuery icon indicating copy to clipboard operation
Swift-Kuery copied to clipboard

Support for fetching N rows at a time instead of all together

Open ianpartridge opened this issue 8 years ago • 2 comments

Does Swift-Kuery support pagination? For example, suppose you have a query which returns 1,000 results.

You might want a way to iterate through chunks of results using a cursor pattern. This would avoid loading all 1,000 results into memory at once.

ianpartridge avatar Nov 16 '16 15:11 ianpartridge

This would be useful for applications that work on large tables (say a million records) and need to process them in small batches (say 1000 at a time), so as to not load all of them into memory at the same time.

na-gupta avatar Nov 16 '16 16:11 na-gupta

Yeah, that's a good plan- I have faced the need for something like this since I've hooked in Swift-Kuery to the Swift Package Catalog data. I think we would need to just add offset to the already existing limit capability.

https://www.postgresql.org/docs/8.3/static/queries-limit.html

rfdickerson avatar Nov 17 '16 07:11 rfdickerson