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

Categories

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

optimization - Measuring actual MySQL query time

How can I measure the execution time of a query without measuring the time it spends waiting for a lock release etc? My only idea was to continuously measure same query and record the fastest time.

Question&Answers:os

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

1 Answer

0 votes
by (71.8m points)

Start the profiler with

SET profiling = 1;

Then execute your Query.

With

SHOW PROFILES;

you see a list of queries the profiler has statistics for. And finally you choose which query to examine with

SHOW PROFILE FOR QUERY 1;

or whatever number your query has.

What you get is a list where exactly how much time was spent during the query.

More info in the manual.


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