title: Long time response for query in ef core
body: <p>I'm creating a select for transactions when group us per user and date, and i need show totalizers also. The result is correct but the time for processing this query is 60s.</p>
  
  <p>I'm using ef core 2.2 and i try using a similar linq expression but the time to response is the same.</p>
  
  <pre><code>public async Task&lt;ListDataPagination&lt;AdvanceIn, TotalizerAdvanceInDate&gt;&gt; AdvanceInDateAsync(int page, int? limit=15)
          {
              IQueryable&lt;AdvanceIn&gt; query;
  
              var data = new ListDataPagination&lt;AdvanceIn, TotalizerAdvanceInDate&gt;();
  
              query = Context.SaleTransaction
                  .Include(s =&gt; s.AdminSale)
                  .ThenInclude(a =&gt; a.PlaceCategory)
                  .Include(s =&gt; s.Transaction)
                  .Where(s =&gt; s.PayIn.Date &lt;= DateTimeOffset.UtcNow.Date.AddDays(6) 
                      &amp;&amp; s.Paid == false
                      &amp;&amp; s.ProcessingPaid == false
                      &amp;&amp; (s.Transaction.Status == TransactionStatus.Authorized || s.Transaction.Status == TransactionStatus.Paid) )
                  .GroupBy(s =&gt; new { s.AdminSaleId, s.PayIn.Date })
                  .Select(s =&gt; new AdvanceIn()
                  {
                      Count = s.Count(),
                      NetAmountSum = s.Select(t =&gt; t.NetAmount).Sum(),
                      GrossAmountSum = s.Select(t =&gt; t.Transaction.GrossAmountWithoutSaleDiscount).Sum(),
                      AdminSale = new SaleTransferReadModel {
                          Id = s.Select(t =&gt; t.AdminSale).First().Id,
                          PlaceName = s.Select(t =&gt; t.AdminSale).First().PlaceName,
                          PlacePhoto = s.Select(t =&gt; t.AdminSale).First().PlacePhoto
                      },
                      PayIn = s.Select(t =&gt; t.PayIn).First(),
                      SaleTransactionId = String.Join(",", s.Select(x =&gt; x.Id.ToString()))
                  })
                  .OrderBy(s =&gt; s.PayIn);
  
              var list = await query.AsNoTracking().ToListAsync();
              data.Totalizer = new  TotalizerAdvanceInDate {
                  Count = list.Sum(t =&gt; t.Count),
                  NetAmountSum = list.Sum(a =&gt; a.NetAmountSum),
                  GrossAmountSum = list.Sum(a =&gt; a.GrossAmountSum)
              };
  
              data.Page = page;
              data.TotalItems = list.Count();
              data.TotalPages = data.TotalItems / limit.Value;
  
              data.Data = query.Skip(limit.Value * page)
                     .Take(limit.Value)
                     .ToList();
  
  
              data.PageTotalizer = new TotalizerAdvanceInDate {
                  Count = data.Data.Sum(a =&gt; a.Count),
                  NetAmountSum = data.Data.Sum(a =&gt; a.NetAmountSum),
                  GrossAmountSum = data.Data.Sum(a =&gt; a.GrossAmountSum)
              };
  
              return data;
          }
  </code></pre>
  
  <p>I expect reduce time for get this query response.</p>