You can do this by declaring server cursors with the DECLARE command:
DECLARE my_cursor CURSOR FOR select * from foo;
And then read its results again with the FETCH command:
FETCH 10 FROM my_cursor;
Sleeping between the FETCH command, you effectively limit the speed of the request.
After that, you can get rid of the cursor by calling COMMIT , ROLLBACK or CLOSE my_cursor
Please note that some types of queries cannot be passed directly using the cursor, but will be run until completion before they print the first line of output. An example would be queries with hash aggregates and large non-indexed sorts. You can lower the cursor_tuple_fraction setting (0.1 by default) to prevent the scheduler from choosing these types of plans, but this is not always possible.
intgr source share