Options and best practices for Multiple Result Sets in Postgres11
The third solution is the best one if you want to save round trips and want to use prepared statements.


If you use cursors, you'll get a round trip per fetch.
When sending multiple statements in one call, you cannot have prepared statements.
You cannot use a stored procedure.
Putting two result sets into one with a join: that way lies madness.


Is is good to avoid excessive client-server round trips, but trying too hard to optimize can result in the opposite.