3 ms·
That's not an advantage, from the DB side the two queries are indistinguishable because they use the same indexes. They will take virtually the same CPU to comp
by mattmanser 4y ago
That's not an advantage, from the DB side the two queries are indistinguishable because they use the same indexes. They will take virtually the same CPU to complete.
If your user has authorization to access this extra data, the actual cost of sending those extra fields properties over the wire is ridiculously trivial.
Think a kilobyte or two, if not a few bytes.
Any justification you think you have for just sending the name + price is utter bullshit. You would save vastly more in bandwidth by not sending whatever dumb graphql code you wrote as part of your front-end build.
That is, unless you are Facebook or Google and have already optimized the hell out of your front-end libraries.
Which I guarantee you aren't and haven't done.
- nonethewiser 4y agoNot at all - removing select “*” from queries is perhaps the lowest hanging fruit for optimizing queries. https://stackoverflow.com/a/25093454 https://stackoverflow.com/a/25093454 I agree that GraphQL is often overkill but specifying fields is powerful and sometimes a big boon.
- mattmanser 4y agoThat's not true unfortunately. Posting a SO Question that's been upvoted by 24 people in a decade is not evidence. Think about this a bit more, those are LOCAL network calls you're talking about. Not calls over the internet. It doesn't matter. Obviously if there's a massive blob in your DB table you're not going to be sending it up regardless if you are using graphQL or not.
- chiefalchemist 4y agoI'm not worried about the DB. Less down the pipe to the browser or app means the user can get to see something sooner. It also mean less for the hardware / browser + JS to swallow. Minor? Maybe. Until you have users with less powerful mobile devices using less than ideal wifi / internet connections. If work provides you with a new device (either as a company perk or because you're well paid) and you live in a major city where mobile data speeds are great these things don't matter. For most everyone else they do. I suppose this explains why so many mobile experiences are so bad? People like you feel the user experience is "utter bullshit". Shame on you.