morningman opened a new issue, #18230: URL: https://github.com/apache/doris/issues/18230
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues. ### Description Support stmt like: ``` // overwrite all table insert overwrite table xxx select * from yyy; // overwrite specified partition of the table insert overwrite table xxx partition(p1) select * from yyy; ``` Similar to normal `insert` stmt, the difference is a `overwrite` keywords. Which means it will erase all data in table(partition) and write new data. ### Use case User can use following step to overwrite a table's data: 1. truncate table 2. insert into table But it is not a atomic operation, after the `truncate` operation and before the `insert` operation, user is unable to read any data because table is empty. By using `insert overwrite`, use can always read the old data before the `insert` finished. ### Related issues To implement this, you can wrap the following step into one `insert overwrite` operation: 1. For overwriting table 1. create a temp table using `create table like` stmt, this will create a table with exactly same schema like origin table. 2. insert data into this temp table. 3. using [replace table](https://doris.apache.org/zh-CN/docs/dev/advanced/alter-table/replace-table) to swap the temp table and origin table. 4. done. 2. For overwrite partition 1. create a [temp partition](https://doris.apache.org/zh-CN/docs/dev/advanced/partition/table-temp-partition). 2. insert data into this temp partition 3. using `alter table replace partition` to swap the temp partition and origin partition. 4. done ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org