Yep, that’s pretty much what I’ve found. The suggestion by Depesz to use
cursors worked wonderfully though. Basically you wrap it up in a
transaction on the server side, and the cursor gives you x amount of
rows at a time when you request it. 1000 rows slurp-read is quite a bit
less resource intensive than 2 million.