Q:

When is the LINQ query actually get executed?

Suppose we have the following LINQ query:
var query =
    from    c in Customers
    where   c.Country == "Italy"
    orderby c.Name
    select  new { c.Name, c.City };

Compiler will convert it like this:
IEnumerable<Customer> query =
        Customers
        .Where( c => c.Country == "Italy" );
        .OrderBy( c => c.Name )
        .Select( c => new { c.Name, c.City } );

Then I coud use the query like this:
foreach ( var name_city_pair in query ) ...

Questions are:

It seems the data specified by the query is already queried out
when I use the foreach loop. So when is this query action take place?
Is it when I define the LINQ query object of IEnumerable<Customer>
?
If  the data number is too large, is there any late query
mechanism? (I am not sure about the right word to describe this, but
I hope you get me.)

A:

LINQ uses deferred execution where possible. In your example the query is only executed when you iterate over the results.
The methods that start with To (such as ToList) cause the query to be executed immediately. Also some methods that return a single value such as Count cause the query to be executed immediately.

A:

Generally speaking LINQ tries to be as lazy as possible.  For example you'd expect it to look something like this behind the scenes:
foreach ( string name in query ) ...
//Roughly translates into
while (query.MoveNext())
{
    string name = query.Current;
    ...
}

Which only gets the results as it needs them, one by one.  This 'lazy'/'streamed' thinking works through the whole query - Select calls OrderBy as needed, which calls Where as needed which calls the Collection as needed.  
The one oddity is the 'OrderBy' which, for implementation reasons, might retrieve all the needed results before ordering them, then stream the result.  This retrieval will occur when it's first called.

