This is a discussion on UNION ALL faster than a UNION? within the Database Support forums, part of the Web Development category; Why is a UNION ALL faster than a UNION?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| UNION ALL doesnot worry about duplicate records,but UNION consider the duplicate records or eliminate duplicate records.UNION ALL display all the records.UNION display the distinct records.so that UNION ALL is faster than UNION Here,we come to one conclusion,UNION achive the DATA REDUNANCY Thanks Prasath.K |
| |||
| Hi there, UNION : eliminates duplicates UNION ALL: retains duplicates Suppose I have five SQL SELECT statements connected by UNION/UNION ALL, how many times should I specify UNION to eliminate the duplicate rows?
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| The union operation, you will recall, brings two sets of data together. It will *NOT* however produce duplicate or redundant rows. To perform this feat of magic, a SORT operation is done on both tables. This is obviously computationally intensive, and uses significant memory as well. A UNION ALL conversely just dumps collection of both sets together in random order, not worrying about duplicates.
__________________ Krishnakumar.S Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily |
| |||
| UNION ALL will be faster b'coz UNION looks for the duplicate values and eliminates it where as UNION ALL will list all.
__________________ -Murali.. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/database-support/1879-union-all-faster-than-union.html | |||
| Posted By | For | Type | Date |
| DiscussWeb IT Community - Technical Support and Technology Discussions | This thread | Refback | 08-18-2007 02:44 AM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Make out of Structure and Union | velhari | C and C++ Programming | 2 | 04-03-2008 03:55 AM |
| Union and Union All | itbarota | Database Support | 2 | 03-03-2008 01:41 AM |
| What is the difference between UNION and UNIONALL in SQL Server? | bluesky | Database Support | 1 | 07-25-2007 05:53 AM |
| what is the UNION in c++? with Example | sundarraja | C and C++ Programming | 1 | 07-20-2007 07:44 AM |
| What's the difference between a structure and a union | prasath | C and C++ Programming | 1 | 07-18-2007 05:14 AM |