▲ | robmccoll 4 days ago | |
Because they each result in round-trips and individual queries to the database rather than a more efficient single round-trip with a join. Note: I don't know the details of GraphQL, but I'm assuming it does the smarter thing. In this paradigm, the places where you are calling map() could probably be replaced with explicit getComments() or getCommentsWithAuthors() or two methods that do just one query each. | ||
▲ | kentonv 3 days ago | parent [-] | |
Well, if the server is a Cloudflare Durable Object running sqlite, then the round-trip to the database is free. https://www.sqlite.org/np1queryprob.html But you are right that this won't work great with traditional databases without significantly more magic on the server side, and in that sense the comparison with GraphQL is... aggressive :) It is still much better than making all the calls client-side, of course. And there are many use cases where you're not querying a database. And maybe there can be some fusion between GraphQL server infrastructure and this RPC-oriented syntax that gives people the best of both worlds? |