Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
518 views
in Technique[技术] by (71.8m points)

mysql 如何只获取sql语句的执行时间,而不需要返回执行结果?

比如一条sql语句,select * from user;
我只想得到这个sql语句的执行时间,而不需要得到这个sql语句执行后返回的结果集。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

查看profiling是否开启

show variables like "%pro%";

开启profiling

set profiling=1;

执行sql语句

select * from user;

查看sql运行时间

show profiles; 

关闭profiling

set profiling=0;

注:Profiling是从 Mysql 5.0.3版本以后才开放的


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...