1.开启和关闭mysql> set profiling=1;mysql> set profiling=0; information_schema 的 database 会建立一个PROFILING 的 table 记录. 2.执行一些语句(自定义语句)mysql>select * from navigation_sub where navPId<6 and navSName='公司介绍'; 3.查询语句执行时间mysql>show profiles; 扩展: mysql查询性
第一种是以毫秒为单位计算的. //伪代码 long startTime=System.currentTimeMillis(); //获取开始时间 doSomeThing(); //测试的代码段 long endTime=System.currentTimeMillis(); //获取结束时间 System.out.println("程序运行时间: "+(end-start)+"ms"); //伪代码 long startTime=System.currentTime