gpt4 book ai didi

MySQL 5.1 : how can i use benchmark() command to test a call to a stored procedure?

转载 作者:行者123 更新时间:2023-12-01 00:33:01 25 4
gpt4 key购买 nike

我正在尝试对存储过程进行基准测试。

  select benchmark(100000000,(select 1));

这个基准有效

但以下基准测试没有:

do benchmark(1000,(call test_login_user('a')));

它会产生以下错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call xpofb_login_user('a')))' at line 1

有什么解决问题的想法吗?

最佳答案

您不能使用 benchmark() 执行此操作,但您可以创建一个存储过程来执行此操作。

这是一个例子:

delimiter $$

create procedure benchmark_test_login_user (p_username varchar(100),
p_count int unsigned)
begin
declare v_iter int unsigned;
set v_iter = 0;
while v_iter < p_count
do
call test_login_user(p_username);
set v_iter = v_iter + 1;
end while;
end $$

delimiter ;

call benchmark_test_login_user('a',1000);

关于MySQL 5.1 : how can i use benchmark() command to test a call to a stored procedure?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3504785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com