INSERT INTO TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...)]
select value1 as col1, value2 as col2... coln from default.dual union all
select value1 as col1, value2 as col2... coln from default.dual union all
...
select value1 as col1, value2 as col2... coln from default.dual;
2条答案
按热度按时间cmssoen21#
更好的方法是创建一个输入文件并立即加载到表中。
创建具有特定行格式(带分隔符)的表
创建表test(a string,b string)行格式字段,以“,”结尾,存储为textfile;
然后把数据加载进去,
将数据inpath“/path”加载到表\u name;
vu8f3i0k2#
许多insert语句比单个语句慢。使用union all将200个插入转换为单个插入: