Umbraco 17: Slow performance when filtering child content using IUmbracoContext.Content

Hi Team,

After upgrading from Umbraco 13 to Umbraco 17, the following code has become very slow:

“metaContents = _contentQuery.Content(ContentParentID)?.Children?.Where(x => x.IsPublished() && x.ContentType.Alias == request.TypeName).OrderByDescending(x => x.UpdateDate).ToList();”

For approximately 410 child records, this query takes around 10–15 minutes to complete.

In Umbraco 13, the same functionality performed significantly faster.

Could you please advise whether there is a recommended replacement or a more efficient approach in Umbraco 17 for:

  • Retrieving children under a published content parent
  • Filtering by content type alias
  • Filtering published content
  • Sorting by UpdateDate

Is there any known performance change or issue with using .Children, .IsPublished(), or ContentType.Alias in Umbraco 17?

Thanks & Regards,
Patan Masood Alikhan

Hi @Masood-h11p

10-15 minutes for that query does sound extreme. I would expect the first time it would be slower whilst it loads everything into the cache, but for 410 child records it should be fairly instant, even on Umbraco 17.

Does it make any difference if you try:

var metaContents = _contentQuery.Content(ContentParentID)
    ?.ChildrenOfType(request.TypeName)
    ?.OrderByDescending(x => x.UpdateDate)
    .ToList();

No need to check for IsPublished as only published content is in the cache.

If that’s still slow, try removing the sort to see if that makes any difference.

Justin

hi @justin-nevitech ,

Thank you. let me try with this.

Thanks!