GraphQL queries are just too darn big!

4 views
Skip to first unread message

Mike Austin

unread,
Sep 25, 2026, 12:28:35 PMSep 25
to PiLuD
query {
  items(where: {
    team: {
      key: {_eq: "ENG" }
    }
    _or: [
      { status: { _eq: "BLOCKED" } }
      { flagged: { _eq: true } }
    ]
  }, sort_by: { dueDate: DESC },
  limit: 10) {
    id
    title
  }
}

I love that GraphQL can represent almost anything, but it becomes so verbose. Sure, you can put all the where logic on one line, as long as you doing mind staring at { { { ... } } }.

I'm thinking of a more condensed version. Something like:

//            where             order by   limit
select items (team.key = "ENG", > dueDate, 100) {
  id
  title
  author (id = 123) {
    id
    name
  }
}

It takes a little time to get used to not having "WHERE", "ORDER BY", and "LIMIT", but personally I can read that faster now that I've seen it for a few minutes. Select and update queries could mirror each other. It would need to support UPSERTs and a few other common features.

update items (id = 456) {
  flagged = true
}

create items (id, title) { // (returned fields) for create
  title = "Do it"
}

Aggregate queries:

select items (team.key = "ENG") {
  count status
  max points
}

Nested create queries:

create author (id, name) {
  books = [
    create books (id, title) { title = "Do it" }
    insert books () { id = 123 }
  ]
}

Subqueries:

create item (id, title) {
  title = "Do it"
  seq_id = update team (id = "ENG") { next_seq_id += 1 }
}

Not completely though through, just an idea.

Raoul Duke

unread,
Sep 25, 2026, 2:00:27 PMSep 25
to pi...@googlegroups.com
hah just use sql
;-)

Mike Austin

unread,
Sep 25, 2026, 5:11:03 PMSep 25
to PiLuD
Jokingly, I mean SQL is not that bad but it's raw - joining tables manually, non-nested data. GraphQL is amazing but so many {{{ }}}s! and no native "and", "or", ">", "=", etc.

On Friday, September 25, 2026 at 11:00:27 AM UTC-7 raould wrote:
hah just use sql
;-)
Reply all
Reply to author
Forward
0 new messages