当前位置: 代码迷 >> 综合 >> 往postgre插入大量数据
  详细解决方案

往postgre插入大量数据

热度:53   发布时间:2023-09-27 22:23:30.0

我的目标是插入100000000万条数据

经过实际操作,用以下方法,能在4分钟完成

declare ii integer;beginII:=1;FOR ii IN 1..100000000 LOOP
INSERT
INTO
test1(id, test1, test2, test3, test4, test5, test6, test7, test8, test9)
VALUES( ii, 'test1', 'test2', 'test3', 'test4', 'test5', 'test6', 'test7', 'test8', 'test9');end loop;return true;end;

创建存储过程

然后运行

select * from creatData2() as tab;