sql中用create or replace table1 as select from table2比较快还是truncate table1;insert into table1 as select from table2比较快
使用create or replace table1 as select * from table2更快,因为这个语句会一次性创建新表并插入数据,而不需要先清空原表。而truncate table1;insert into table1 as select * from table2会先删除原表的所有数据,然后再一条条插入新数据,这个过程比较耗时。
原文地址: https://www.cveoy.top/t/topic/cOqH 著作权归作者所有。请勿转载和采集!