Yesterday we have covered some basic points which will help us to understand SQL Server Concatenation operator. If you have missed that post, you can click here to go to the link.
Concatenation operator is a good example of an operator which receives multiple inputs. As an example, let us run following statement.
USE [AdventureWorks2012] SELECT * FROM Person.Person UNION ALL SELECT * FROM Person.Person UNION ALL SELECT * FROM Person.Person
In the example, concatenation operator receives the result of all Clustered Index Scan operators. Internally, it copies all the rows to one output by calling Init() and GetNext().
We can decode the query plan in text and it looks like following image.
SQL Server query processor executes this plan in the same order as it appears on the plan i.e. first is going to be the top one and last is the end one.
Tomorrow we are going to explore more on this operator, till then.