我想向postgresql数据库中插入10亿行浮点数据,以便测试各种postgis函数的性能。我的尝试需要很长时间,似乎效率很低,内存消耗量似乎会急剧增加。有没有人能建议更好的做法-我想每次插入100万行可能会更好,但我不知道如何构建对象,例如:
(a, b),(c, d)
进行插入。
非常感谢任何帮助。请注意,我对SQL还是新手,无法理解需要高级计算机科学学位才能掌握的超优化解决方案:) 我正在寻找“足够好”的解决方案。
谢谢,
安德鲁
do $$
declare
position float := 0;
measurement float := 0;
counting integer := 0;
begin
while position < 100 loop
INSERT into lat_longs values (counting, postition);
position := position + 0.0000001;
counting := counting + 1;
end loop;
raise notice 'count: %', counting;
end$$;