title: Entity framework doesn't use JOIN in SQL queries
body: <p>I wrote some code for one to many relationships getting <code>Invoice</code> instances from <code>Defect</code> instances. </p>
  
  <pre><code>mydbEntities ef = new mydbEntities (); //mydbEntities is derived from DbContext
  ef.Database.Log = s =&gt; System.Diagnostics.Debug.WriteLine (s);
  Invoice inv = ef.Defects.Where (i =&gt; i.Id == 5).SingleOrDefault ().Invoice;
  </code></pre>
  
  <p>That is part of EDM diagram:</p>
  
  <p><img src="https://i.stack.imgur.com/6CR5J.jpg" alt="EDM diagram"></p>
  
  <p>I'm curious why it did not invoke INNER JOIN, instead of it 2 SQL queries were executed. In the book I'm now reading ("Mastering Entity Framework"), in the same situation an INNER JOIN was invoked. </p>
  
  <p>Output from Debug:</p>
  
  <pre><code>SELECT TOP (2) 
      [Extent1].[Id] AS [Id], 
      [Extent1].[PositionId] AS [PositionId], 
      [Extent1].[InvoiceId] AS [InvoiceId], 
      [Extent1].[Count] AS [Count], 
      [Extent1].[Reason] AS [Reason]
      FROM [dbo].[Defect] AS [Extent1]
      WHERE 5 = [Extent1].[Id]
  
  
  -- Executing at 6/21/2015 11:21:02 AM +05:00
  
  -- Completed in 1 ms with result: SqlDataReader
  
  
  
  Closed connection at 6/21/2015 11:21:02 AM +05:00
  
  Opened connection at 6/21/2015 11:21:02 AM +05:00
  
  SELECT 
      [Extent1].[Id] AS [Id], 
      [Extent1].[Number] AS [Number], 
      [Extent1].[InvoiceDate] AS [InvoiceDate]
      FROM [dbo].[Invoice] AS [Extent1]
      WHERE [Extent1].[Id] = @EntityKeyValue1
  
  
  -- EntityKeyValue1: '1' (Type = Int32, IsNullable = false)
  
  -- Executing at 6/21/2015 11:21:02 AM +05:00
  
  -- Completed in 0 ms with result: SqlDataReader
  
  
  
  Closed connection at 6/21/2015 11:21:02 AM +05:00
  </code></pre>
  
  <p>And one more question: How do 2 queries against 1 with INNER JOIN impact on performance in high-loaded application with large database.</p>