I was reading the efficient querying microsoft article and there is a part which is unclear to me:
When split query is used, the resultsets of all but the last query are buffered - unless MARS (Multiple Active Result Sets) is enabled on SQL server.
To illustrate my question, let assume I have a code that creates 3 query:
var questionsStream = stackoverflowContext.Set<Question>()
.Include(q => q.Statistics)
.Include(q => q.Answers)
.AsSplitQuery();
foreach (var question in questionsStream)
//...
Which table result is streamed?
- Question table,
- Answer table,
- random/depends on (what?)
If it is the last Include() I should order my Includes to have the possibly longest one at the end of the chain (to spare memory), right?
I searched SO for "internal buffering", "split query", "ef streaming", "ef MARS" and similar terms before asking the question. I found out what happens if MARS is enabled by this SO post, but no answer to what happens when it is disabled.