- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to measure actual MySQL query time?
To measure actual MySQL query time, we can use the concept of profiling that must be set to 1 before executing the query.
The order must be like this.
Set profiling to 1 Then execute query Then show profiles
Now, I am applying the above order to get the actual MySQL query time −
mysql> SET profiling = 1; Query OK, 0 rows affected, 1 warning (0.00 sec)
After that I am executing the following query −
mysql> SELECT * from MilliSecondDemo;
The following is the output
+-------------------------+ | MyTimeInMillSec | +-------------------------+ | 2018-10-08 15:19:50.202 | +-------------------------+ 1 row in set (0.00 sec)
To know the actual time of the above query, use the following query
mysql> SHOW PROFILES;
After executing the above query, we will get the output as shown below −
+----------+------------+------------------------------+ | Query_ID | Duration | Query | +----------+------------+------------------------------+ | 1 | 0.00051725 | SELECT * from MilliSecondDemo| +----------+------------+------------------------------+ 1 row in set, 1 warning (0.00 sec)
Advertisements