UNION - background

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.

UNION - background

Hi, I've a question on UNION/UNION ALL. In a query using UNION ALL, if we are using the same table in two parts , would the table be read twice and distributed to spool twice? Like in the below query, Same table TABLE_1 is used twice with different conditions. SEL * FROM TABLE_1 WHERE COL_1 IN (1,2,3) UNION ALL SEL * FROM TABLE_1 WHERE COL_2 IN (A,B,C)
1 REPLY
N/A

Re: UNION - background

Why don't you simply compare Explains?

 

And why do you access the same table twice instead of an ORed WHERE-condition?