title: Entity Framework and compiled expressions performance
body: <p>We are using EF for our data access and we have a query like this:</p>
  
  <pre><code>Expression&lt;TTable, bool&gt; expression = CreateSomeExpression();
  var filter = finalExpression.Compile();
  var results = db.t_Table.Where(filter).Select(x=&gt;...);
  </code></pre>
  
  <p>My question is, will EF construct the correct query given a compiled  expression?</p>
  
  <p>As an example, if my table is:</p>
  
  <pre><code>t_Table 
  ( key int,
    value_1 varchar(30),
    value_2 varchar(30)
  )
  </code></pre>
  
  <p>And the expression to be compiled is</p>
  
  <pre><code>p =&gt; p.value_1 = 100
  </code></pre>
  
  <p>will this translate (in EF) to:</p>
  
  <pre><code>select * from t_Table where value_1 = 100
  </code></pre>
  
  <p>or will it translate to </p>
  
  <pre><code>select * from t_Table
  </code></pre>
  
  <p>followed by a linq query on the results?</p>
  
  <p>Is there a way to check what sql query will actually be called on the DB by EF?</p>
  
  <p>Many thanks in advance,</p>
  
  <p><strong>Update</strong></p>
  
  <p>Whilst the accepted answer is 100% correct (and therefore is the accepted answer), the solution to my problem was to simply remove the compilation. Removing that resulted in the correct SQL query with the correct <code>where clause</code>.</p>