Slow query due to relation

hi guys,

ive a major problem with performance. we have over average 5k articles linked to category, but when we query category limit 10 on graphql without articles field, it toook 40s locally on my machine.
i have only about 6000 categories, which does not make sense.
and this is one issue,

second issue:
var res = await strapi.query(“category”).find({ _limit: 10});

there is no support for fields selected for this function, which makes things very incovinient.
it will return all articles associated with each category, did i miss any way to skip them? and does it really works in the core library , or is it just fetching all and not returning them?


We plan to do a database refresh in Q3, depending on your need, I suggest filtering and paging articles based on a category. Example with REST would be something like:

That’s a basic example, using a basic filter but it can also be done this way with GraphQL also.

You are correct in that right now the query in GQL is inefficient because it fetches everything from the DB and filters in Javascript, our database fresh will address this.

1 Like

but Q3? thats very long …

1 Like

Is there any news about this refresh? Q3 is now

I’m also facing the similar issue even with strapi REST api. Slow queries after creating few relations.

We are still working on the v4, I don’t have a set date as of yet but we will go through a 1 month beta period before the stable release.