1.
create or replace function inserttables(num int) returns void as
$$
declare
sql varchar;
begin
for n in 1..num loop
sql = 'insert into test(id,name) values('|| n ||', ' || '''wang''' ||')';
execute sql;
end loop;
end
$$
language pluxsql;
select inserttables(1500000);
2.
create table test(id int,name text);
insert into test select generate_series(1,5000000),'a';