Open mottibec opened 6 years ago
So, it appears that all QueryExecutors will execute their queries in-memory at some point during the process. This is a relatively standard pattern, even in WebAPI proper (return query.ToList() happens all the time).
So the question becomes, it is possible to delay materialization of the query until it is later in the pipeline. .NET Core has done so much work to optimize for performance, I'll have to see what we can do.
Hello, I think also this line materializes results unnecessarily:
I tried changing from:
return new QueryResult(await query.ToArrayAsync(cancellationToken).ConfigureAwait(false));
to
return new QueryResult(query);
and there is no more loading of the whole query result in memory.
in
DefaultQueryExecutor.ExecuteQueryAsync
there's a call toquery.ToList()
that loads all results into memory