我可以在 Redshift 中从一个 table 复制到另一个吗

Can I copy from one table to another in Redshift

我明白 the COPY command imports lots of data very efficiently. But copying data from one table to another with the INSERT command is slow. Is there a more efficient way to copy data from one table to the other? Or should I use the UNLOAD command 将 table 卸载到 S3 中,然后从那里复制回来?

您可以将 insert 转换为 new_table (select * from old_table) .

但是对于更大的 tables 你应该总是从旧的 table 卸载然后复制到新的 table.

复制命令并行加载数据并且运行速度很快。卸载还并行卸载数据。因此卸载和复制是将数据从一个 table 复制到另一个的好选择。

当您执行复制命令时,它会自动对您的数据进行编码(压缩)。当您插入 (select * from) 时,它不会执行 compression/encoding。创建新 table.

时需要显式应用编码类型

如果要将记录从source_table复制到target_table。那么query必须在下面

insert into target_table select * from source_table