Complexity Exception Error When Querying Subitems

Hello,

I have a board with 4 groups, ~170 items, and some number of sub items. I’m attempting to pull the data from the sub item columns. I initially attempted the following query:

query{
boards(ids:2596083107){
items{
id
subitems{
id
parent_item {
id
}
column_values{
title
text
}
}
}
}
}

This returned a complexity error: “Query has complexity of 24011020, which exceeds max complexity of 5000000”

I attempted to get just the sub item data

query{
boards(ids:2596083107){
subitems{
id
parent_item
column_values{
title
text
}
}
}
}

I was met with: “Field ‘subitems’ doesn’t exist on type ‘Board’”

I went back to my original query and attempted to break it up into pieces based on group:

query{
boards(ids:2596083107){
groups(ids: “new_group”){
items{
subitems{
id
name
column_values{
text
title
}
}
}
}
}
}

again, I got a complexity error.

I am at a loss for what else to try. These are not complex queries. If this were SQL, they’d be returning a couple thousand rows, max. How can I reduce complexity of already simple queries to accomplish my goal?

Hi @regnidem!

The reason you see this complexity error is because your query is too nested. Nesting queries inside queries will increase the complexity of your query exponentially. Currently, the maximum number of nested queries allowed is 6.

I recommend checking out our rate limiting guide for more on nested queries and how to calculate cost.

This error “Field ‘subitems’ doesn’t exist on type ‘Board’” happened because subitems live on a different board from items. To get the subitem board ID, you can click on the subitem and look to your URL for the new value.

I hope this helps!