Query complexity issue for Team retrieveAll

We are trying to retrieveAll Team object but it is failing with query complexity issue.

Query is below :
{
teams {
id
name
picture_url
users {
birthday
country_code
created_at
current_language
email
enabled
encrypt_api_token
id
is_admin
is_guest
is_pending
is_verified
is_view_only
join_date
location
mobile_phone
name
phone
photo_original
photo_small
photo_thumb
photo_thumb_small
photo_tiny
sign_up_product_kind
time_zone_identifier
title
url
utc_hours_diff
}
}
}

Getting error :
{“errorDetail”:“{“errors”:[{“message”:“Query has complexity of 28013010, which exceeds max complexity of 5000000”}],“account_id”:11771408,“statusCode”:400}”}

Currently instance is having sample data with 7 teams and 9 users
on 30th of September we successfully got response with total 7 teams and 9 users. but now showing Query complexity issue.

How we can avoid the issue with query complexity to retrieve the same data as above.

Regards,
Ashwini

hi @Yash

One possibility is to retrieve all teams first and then loop through each of the teams to get the users. Alternatively you can retrieve only the userId’s from each team (leaving out all the other fields) and loop through the users to get the details. Do you really need all the details (like the photo in 5 different formats)?

hi @basdebruin

Same query was working till 30th August. it has recently started failing , so we need to know if complexity has changed from your end?

Hi @basdebruin , could we get any insight on complexity of Teams object, whether there was any complexity change in API , since this above query worked fine before 30th Sep.

Thanks

Hi @Yash

I guess this is one for monday support to answer. I am just a fellow user :slight_smile:

Hello @Yash!

In this case, you can avoid hitting the limit by adding the IDs of your teams as an argument to the “teams” object.

You can first query your teams’ IDs in one request and then use them as an argument in the next one.

Hope that helps!

Cheers,
Matias