plpgsql insert 性能 测试

有时需要执行一些sql脚本,带逻辑控制语句,又不想用高级语言C#、Java之类的,可以直接用plpgsql,类似于Oracle的plsql。

 1 do language 'plpgsql' $$
 2 declare
 3   i integer;
 4 begin
 5   --raise notice 'hello world';
 6   
 7   for i in 5..100000 loop
 8     insert into dbo.a_org_type(id, des)
 9     values(i, 'shang hai xu hui');
10   end loop;
11 end;
12 $$
13 
14 --select count(*) from dbo.a_org_type;
15 --delete from dbo.a_org_type where id > 4;

耗时 = 1.5秒

on windows7 x64  

Intel Pentium cpu B950 2.1GHz 

posted on 2018-04-05 22:40  jonney_wang  阅读(196)  评论(0编辑  收藏  举报

导航