3 ms·
SQL queries really need to separate out the "run the query" from the "now send me these details about the results" part. In many cases, I'd like that latter da
by londons_explore 5y ago
SQL queries really need to separate out the "run the query" from the "now send me these details about the results" part.
In many cases, I'd like that latter data transfer stage to be smarter. Give me back some smart object which represents a result set, but then lazily only retrieves the information my code actually uses. At the same time, try to predict what information I'll be needing from the result set to avoid server round trips. (If I'm iterating through a result set in order accessing 4 of the 8 columns, you can probably just batch send the data my code uses).
- jayski 5y agohttps://www.postgresql.org/docs/14/plpgsql-cursors.html https://www.postgresql.org/docs/14/plpgsql-cursors.html
- djbusby 5y agoCursors are a for rows at a time. Sounds like above wants `Select *` but only magically pick the columns/fields used by the code.
- mike_hock 5y agoWhich would be possible, but not without the server round trips that he also seems to want to get rid of. Basically, he wants a bunch of complexity and heuristics to be pushed into the query planner, the client, and the protocol, just so he doesn't have to write the column names.