News for hackers. Stuff that matters.
Re:Many small queries are efficient in SQLite by ubercore on Tuesday February 16, 2021 @11:51AM (#26155904)
A straightforward implementation certainly would have that problem. You have to put a decent amount of effort in to reduce query count to fill a nested query graph.
Re:Many small queries are efficient in SQLite by rtorr on Tuesday February 16, 2021 @12:24PM (#26156284)
Not really. A straightforward implementation has nothing to do with database usage. A resolver is an endpoint. You can leverage that like you can in any other http backend server.
Re:Many small queries are efficient in SQLite by ubercore on Tuesday February 16, 2021 @01:45PM (#26157268)
Nested resolvers can incur extra queries as you follow down the tree, unless you put extra effort into pre-fetching what child nodes need, or some kind of data loader as GP suggested.

  query {
    parent {
      child {
        field
      }
    }
  }

A straightforward, naive implementation would resolve `parent`, then a resolver for `child` would execute, then for `field`. If `child` is a table linked by an FK, a second query would be executed, unless you pre-fetch the results through a join when resolving `parent`.