Doris supports atomic table replacement operations for two tables. This is only applicable to OLAP tables.
ALTER TABLE [db.]tbl1 REPLACE WITH TABLE tbl2 [PROPERTIES('swap' = 'true')];
Replace table tbl1 with table tbl2.
If swap is true, after the replacement, data in tbl1 will be replaced by that in tbl2, while data in tbl2 will be replaced by that in tbl1. In other words, the two tables will swap data.
If swap is false, after the replacement, data in tbl1 will be replaced by that in tbl2 and tbl2 will be deleted.
In fact, table replacement is to combine the following operations into one atomic operation.
Assuming that table A is to be replaced with table B, and swap is set to true. The operations to be implemented are as follows:
If swap is set to false, the operations are as follows:
swap defaults to true, meaning to swap the data between two tables.swap is set to false, the table being replaced (table A) will be deleted and cannot be recovered.