
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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)
- Related Articles
- MySQL query to check how to get time difference
- How to measure elapsed time in python?
- How to measure elapsed time in Java?
- How do we measure time?
- How to measure the execution time in Golang?
- MySQL query to insert current date plus specific time?
- How to use actual row count (COUNT(*)) in WHERE clause without writing the same query as subquery in MySql?
- How to measure time with high-precision in Python?
- How to measure execution time for a Java method?
- How to measure elapsed time in nanoseconds with Java?
- How to multiple insert or batch insert at a time in MySQL query?
- MySQL query to extract time in a format without seconds
- MySQL query to select rows one batch at a time
- How to measure time taken by a function in C?
- MySQL query to select records with a particular date and time?

Advertisements