AEM 6.5 paginated graphql query
Hello everyone,
I'm having a problem in understanding how graphql paginated queries are working in AEM 6.5.
From the documentation https://experienceleague.adobe.com/en/docs/experience-manager-learn/getting-started-with-aem-headless/how-to/large-result-sets I can see that Adobe suggests to use paginated query type for large results (without saying how much these results should be...).
In my case, I have a folder with around 3000 content fragments (divided in subfolder not to having too much element under the same folder), all with the same content type; my query gets these elements selecting only the resource path, here is the query code:
query myQuery {
elementPaginated(
first: 5
sort: "dateField DESC"
filter: {_path: {_expressions: {value: "/content/dam/project/root-folder/", _operator: STARTS_WITH}}}
) {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
_path
}
}
}
}Only selecting the path the query is very slow (around 10 sec to execute); from the logs I saw that the SQL2 repository query itself is very fast (100 ms) but after the resources are selected (the query selects all the 3000 elements) for each element the content fragment schema is loaded, even if the query says that I want only the first 5 elements.
The Java class that loads the schema is com.adobe.cq.dam.cfm.graphql.AbstractFetcher; I have all the suggested indexes for assets and content fragments.
Has anyone faced this situation before?
Thank you in advance!