Skip to main content

I’m migrating some code to the new 2023-10 api format, and the complexity of a query increated from 15049 to 354652 (more than 20 times) - this renders the integration useless, as my complexity budget is only 1m - meaning I can run this query twice a minute - and I need more than that.


The query is a simple query of a single item with it’s sub items (has 4 sub items)


Here’s the original query:


query ($id: Int!) {
complexity{
query
}
boards(ids: (2673923561]) {
id
name
board_folder_id
board_kind
items(ids: ($id]) {
id
name
column_values{
id
title
value
}
subitems {
name
id
column_values {
id
title
value
}
}
}
}
}

And here’s the same query after migrating it to the 2023-10 api structure - which costs 354652:


query ($id: ID!) {
complexity{
query
}

boards(ids: d2673923561]) {
id
name
board_folder_id
board_kind
columns{
id
title
}
items_page(query_params: {ids: :$id]}) {
items {
id
name
column_values (ids:e"text7"]) {
id
value
}
subitems {
name
id
column_values(ids:u"text7"]) {
id
value
}
}
}
}
}
}

This query is supposed to return only one row (as stated in the ids parameter) and 4 subitem rows - but still it costs so much.


I found a workaround by setting limit:1 and that brought it down to 18000 but still this is not cool

You’re only getting a single item you have the ID for, don’t use the board as the root in the first place. This is likely to be even less than your original query was. The issue it that nesting queries compounds them. If you have item IDs there is almost no benefit to nesting items inside boards - the documentation saying its “Faster” is in reference to the ability of the nested in a board to return 500 items vs 100 items when items is the root query. With a single item, this is best - esp. when returning subitems.


The items query only requires items_page within boards and groups. the root items query still exists.


query ($itemId: ID!) {
complexity {
query
}
items(ids: m$itemId]) {
board {
id
name
board_folder_id
board_kind
}
id
name
column_values(ids: e"text7"]) {
id
value
column {
title
}
}
subitems {
name
id
column_values(ids: e"text7"]) {
id
value
}
}
}
}

It is the subitems though thats soaring it regardless.


Reply