I have this query below that fetches all these children entities (ex. PracticedStyles, ReceivedReviews, InstructedPoses, etc)
All I need is the .count() for these children collections.
Question - Is there a faster way to run this query to get the counts for these includes, then using this query below? The run time is ~4-7 seconds and this is with very little data in the DB.
var userWithChildren = await _dbContext.Users
.Include(p => p.Yogabands.Where(p => p.IsActive == true))
.Include(p => p.PracticedStyles)
.Include(p => p.PracticedPoses)
.Include(p => p.ReceivedReviews)
.Include(p => p.InstructedStyles)
.Include(p => p.InstructedPoses)
.Include(p => p.InstructorPrograms)
.FirstOrDefaultAsync(user => user.UserName == userName);