drop procedure if exists get_user;
delimiter #
create procedure get_user
(
in p_user_id int unsigned,
in p_explain tinyint unsigned
)
begin
if (p_explain) then
explain select * from users where user_id = p_user_id;
end if;
select * from users where user_id = p_user_id;
end#
delimiter ;
call get_user(1,1);
3条答案
按热度按时间wn9m85ua1#
你可以试试
cbwuti442#
目前你还不能解释mysql中的存储过程-但是你可以这样做:
d4so4syb3#
MySQL 5.7之前:
EXPLAIN
只对SELECT
语句起作用,除非使用EXPLAIN
tablename(DESCRIBE tablename
的别名)5.7后:
EXPLAIN
使用SELECT DELETE INSERT REPLACE UPDATE
语句