当前位置:网站首页>怎么在opengauss中进行测试自己添加的新函数的性能(循环n次的运行时间)?
怎么在opengauss中进行测试自己添加的新函数的性能(循环n次的运行时间)?
2022-08-03 16:28:00 【DarkAthena】
怎么在opengauss中进行测试自己添加的新函数的性能(循环n次的运行时间)?
采纳答案1:
写个匿名块,循环执行你想要测试的函数
create function test_func return int isbeginreturn 1;end;declarei int;begini:=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效率会更高
其他答案1:
写个匿名块,循环执行你想要测试的函数
create function test_func return int isbeginreturn 1;end;declarei int;begini:=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效率会更高
边栏推荐
猜你喜欢
随机推荐
Detailed explanation of ReentrantReadWriteLock
protobuf 中数据编码规则
从零开始搭建MySQL主从复制架构
高效的组织信息共享知识库是一种宝贵的资源
【翻译】关于扩容一个百万级别用户系统的六个课程
C语言03、数组
高薪程序员&面试题精讲系列132之微服务之间如何进行通信?服务熔断是怎么回事?你熟悉Hystrix吗?
高效的组织信息共享知识库是一种宝贵的资源
Selective Search学习笔记
实时渲染流程操作复杂吗,如何实现?
Introduction to the advantages of the new generation mesh network protocol T-Mesh wireless communication technology
从MatePad Pro进化看鸿蒙OS的生态势能
How to start an NFT collection
一文看懂推荐系统:召回01:基于物品的协同过滤(ItemCF),item-based Collaboration Filter的核心思想与推荐过程
I am doing open source in Didi
纯纯粹粹纯纯粹粹
How to analyze the weekly activity rate?
使用 PowerShell 将 Windows 转发事件导入 SQL Server
SwinIR实战:如何使用SwinIR和预训练模型实现图片的超分
[Deep Learning] Today's bug (August 2)