title: UNION / UNION ALL slow or not working
body: <p>I have two tables full of customer survey response data. I've been running queries on them separately that return results in less than one second, but if I union them it seems to run forever. After 5+ minutes no results are returned yet and no errors have been thrown, it's still apparently "running" but I can't figure out what it's actually trying to do that could be so complicated.</p>
  
  <p>In essence, my queries that work separately are:</p>
  
  <pre><code>SELECT
  oldsurveys.column1 as [something1],
  oldsurveys.column2 as [something2],
  oldsurveys.column3 as [something3],
  'staticvalue1' as [something4],
  oldsurveys.column5 as [something5]
  FROM
  database1.dbo.table1 oldsurveys
  WHERE
  oldsurveys.column1 = 'something'
  AND oldsurveys.column2 &gt;= '2014-01-01 00:00:00'
  ORDER BY [something2], [something1]
  
  SELECT
  newsurveys.column1 as [something1],
  newsurveys.column2 as [something2],
  newsurveys.column3 as [something3],
  newsurveys.column4 as [something4],
  'staticvalue2' as [something5]
  FROM
  database2.dbo.table1 newsurveys
  WHERE
  newsurveys.column1 = 'something'
  AND newsurveys.column2 &gt;= '2014-01-01 00:00:00'
  ORDER BY [something2], [something1]
  </code></pre>
  
  <p>If I run this, I get two tables of data returned almost instantly. If I add <code>UNION ALL</code> between the two select statements, comment out the first <code>ORDER BY</code> and try running again it just runs and runs and runs, no results...</p>
  
  <p>Any idea what I'm doing wrong? Would the tables being in different databases cause this, and if so, is there a workaround?</p>