Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I cannot say I understand your whole post, but I had a recent experience that might apply here . . . and since you have zero posts . . . I'll give it a try.</p> <p>I had something like this:</p> <pre><code>var results = from ... ; foreach(results) { do something } </code></pre> <p>Worked great, but it took four minutes to run because the results contained 4 Million records. Since I am a LINQ/EF4 newb, I changed it to this:</p> <pre><code>var results = from&lt;blah&gt;; int count = 0; foreach(results) { if (count++ &gt; 100) break; do something } </code></pre> <p>Upon doing this, it timed out at the foreach statement after the 100th record and while terminating the foreach loop.</p> <p>After much reading and experimenting the conclusion I came to is that the Query Will Complete!!!</p> <p>Like it or not, the Query will run to completion.</p> <p>So in its original format, I ran the Query out in the foreach loop itself by getting each little piece one at a time. Doing it that way would never timeout since resolving the next item in the results is really quick.</p> <p>However, once I put in the break statement, after the 100th record, the query tried to complete itself in a single gulp and so it would timeout because the 4 million records could not be accepted in the timeout that a single call gets.</p> <p>That fact that results is about to go out of scope and be destroyed didn't matter. The Query had to be completed . . . used or not . . . the query has to be completed.</p> <p>It was a very frustrating, but enlightening exercise.</p> <p>Frank</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload