
# Append
#### 算子说明
Append用于多个关系集合的追加，同时处理包含一个或多个子计划的链表。
#### 典型场景
- 带UNION的SQL语句场景。
- 带UNION ALL的SQL语句场景。
 
#### 示例
**示例1：**带UNION的SQL语句场景。
```
--数据准备。 
gaussdb=# DROP TABLE IF EXISTS t1;
gaussdb=# DROP TABLE IF EXISTS t2;
gaussdb=# CREATE TABLE t1(c1 number, c2 number, c3 number); 
CREATE TABLE 
gaussdb=# INSERT INTO t1 VALUES(generate_series(1, 100), 2, 3); 
INSERT 0 100 
gaussdb=# CREATE TABLE t2(c1 number, c2 number, c3 number); 
CREATE TABLE 
gaussdb=# INSERT INTO t2 VALUES(generate_series(1, 100), 2, 3); 
INSERT 0 100
--执行结果。 
gaussdb=# EXPLAIN SELECT * FROM t1 UNION SELECT * FROM t2; 
                              QUERY PLAN
-----------------------------------------------------------------------
 Streaming (type: GATHER)  (cost=28.03..28.94 rows=42 width=96)
   Node/s: All datanodes
   ->  HashAggregate  (cost=26.72..26.98 rows=42 width=96)
         Group By Key: t1.c1, t1.c2, t1.c3
         ->  Append  (cost=0.00..26.52 rows=42 width=96)
               ->  Seq Scan on t1  (cost=0.00..13.13 rows=20 width=96)
               ->  Seq Scan on t2  (cost=0.00..13.13 rows=20 width=96)
(7 rows)
```
**示例2：**带UNION ALL的SQL语句场景。
```
gaussdb=# EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2; 
                              QUERY PLAN
-----------------------------------------------------------------------
 Streaming (type: GATHER)  (cost=1.62..28.70 rows=40 width=96)
   Node/s: All datanodes
   ->  Result  (cost=0.00..26.26 rows=40 width=96)
         ->  Append  (cost=0.00..26.26 rows=40 width=96)
               ->  Seq Scan on t1  (cost=0.00..13.13 rows=20 width=96)
               ->  Seq Scan on t2  (cost=0.00..13.13 rows=20 width=96)
(6 rows)
--删除表。
gaussdb=# DROP TABLE t1,t2;
```
