怎么在opengauss中进行测试自己添加的新函数的性能(循环n次的运行时间)?
写个匿名块,循环执行你想要测试的函数
create function test_func return int is begin return 1; end; declare i int; begin i:=1; raise notice '%',sysdate; loop perform test_func ; i:=i+1; if i=1000 then exit; end if; end loop; raise notice '%',sysdate; end;
当然,如果对于同一个输入值,始终返回相同的输出值,加上IMMUTABLE效率会更高