home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,815 of 19,505   
   bod to Erland Sommarskog   
   Re: Using a 'Union' kills the performanc   
   24 Jun 10 00:34:43   
   
   XPost: microsoft.public.sqlserver.programming   
   From: bod@newsguy.com   
      
   Doesn't UNION imply a distinct over the entire combined result set?   
   (effectively SELECT DISTINCT * FROM (SELECT ... UNION ALL SELECT ...))   
   If you can construct the query such that each half of the union is   
   exclusive, then UNION ALL may yield better performance.   
      
   On 6/23/2010 7:16 PM, Erland Sommarskog wrote:   
   > Query Builder (querybuilder@gmail.com) writes:   
   >   
   > A good start is to look at the query plans, at least the estimated   
   > plan for the UNION query. Since the query never seem to complete,   
   > looking at the actual plans may be more difficult.   
   >   
   > You say that each section of the UNION returns 200 rows, but how big   
   > are the underlying tables? That is, is there any potential for a   
   > query plan from hell?   
   >   
   >   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca