title: SQL Server Cross Database Query from On-Premises to Azure
body: <p>Two SQL Server</p>
  <ol>
  <li>On-Premises</li>
  <li>Azure</li>
  </ol>
  <p>When I run the T-sql</p>
  <ol>
  <li>On-Premises only</li>
  </ol>
  <blockquote>
  <p>Select top 100 * from Orders</p>
  </blockquote>
  <p>The result is very fast as usual.</p>
  <ol start="2">
  <li>Azure Only</li>
  </ol>
  <blockquote>
  <p>Select top 100 * from Orders_2</p>
  </blockquote>
  <p>The same, Fast.</p>
  <ol start="3">
  <li>This is the point.
  No matter what I used &quot;Link-Server&quot; or &quot;OPENDATASOURCE&quot;.</li>
  </ol>
  <blockquote>
  <p>Select top 100 * from Orders a  LEFT OUTER JOIN</p>
  <p><strong>[AZUREDB]</strong>.DB01.dbo.Orders_2 a2  ON a2.ID= a.ID</p>
  </blockquote>
  <p>OR</p>
  <blockquote>
  <p>Select top 100 * from Orders a  LEFT OUTER JOIN<br />
  <strong>OPENDATASOURCE</strong>('SQLOLEDB','Data Source=AzureDB;User
  ID=XXX;Password=XXX') .DB01.dbo.Orders_2 a2  ON a2.ID= a.ID</p>
  </blockquote>
  <p>It takes a very long time, about 15 mins.
  What's happened? and how to fix it?</p>