Union query is very sloooooow
Posted on 2006-05-29
I have a union query. It is based upon two queries, each brings fields from multiple tables, some of which are calculated.
One query it is based upon returns about 1500 records in a few seconds.
The other query returns about 33000 records in, say, 20 seconds.
The union (SELECT * FROM AuftragCostEigenes UNION ALL SELECT * FROM AuftragCostAkkordant) takes over five minutes to complete.
There is no sorting in either base query.
As the total time for the individual queries is dramatically less than the union query does anyone have any ideas why / suggestions that could improve matters.