[HN Gopher] How Slow Is Select *?
___________________________________________________________________
How Slow Is Select *?
Author : FedericoRazzoli
Score : 9 points
Date : 2022-01-24 10:41 UTC (1 days ago)
(HTM) web link (vettabase.com)
(TXT) w3m dump (vettabase.com)
| londons_explore wrote:
| 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 wrote:
| https://www.postgresql.org/docs/14/plpgsql-cursors.html
| scrapheap wrote:
| One thing I don't like about using `SELECT *` in code is that it
| hides information from the your future self. When I come back to
| a piece of code in a couple of years time, knowing which columns
| I'm selecting helps provide context for the code using that
| query.
| flatiron wrote:
| People say what they will with JPA but at least it makes
| "context for the code" very clear.
___________________________________________________________________
(page generated 2022-01-25 23:01 UTC)