Is there a way/tool to test an SQL query without executing it?

David Makogon

Member
Joined
Apr 24, 2016
Messages
35
Points
0
I found slow queries in slow-query-log file on my hosting and knew where they came on my website cms. I did a search for this on Google search and they showed tutorials on how to fix the problem but the tool or way they used to check with their queries then I don't know.

This is which I mean.

check-time-for-a-mysql-query.png

I want to run the SQL query and know how much time will it get? how can I do that without executing it directly on my website cms?

Thanks in advance.
David
 

UWH-David

Member
Registered
Joined
Jan 18, 2016
Messages
45
Points
8
I found slow queries in slow-query-log file on my hosting and knew where they came on my website cms. I did a search for this on Google search and they showed tutorials on how to fix the problem but the tool or way they used to check with their queries then I don't know.

This is which I mean.

View attachment 1738

I want to run the SQL query and know how much time will it get? how can I do that without executing it directly on my website cms?

Thanks in advance.
David
Hmmm, I think the profilings command might accomplish this. From a stackoverflow entry:

Code:
mysql> set profiling=1;
mysql> select count(*) from comment;
mysql> select count(*) from message;
mysql> show profiles;

+----------+------------+------------------------------+
| Query_ID | Duration   | Query                        |
+----------+------------+------------------------------+
|        1 | 0.00012700 | select count(*) from comment |
|        2 | 0.00014200 | select count(*) from message |
+----------+------------+------------------------------+
2 rows in set (0.00 sec)
Another thing you can do if you have slow query logging enabled is run the following command for a break down :

Code:
mysqldumpslow -s c -t 10
 
Latest Threads
Replies
0
Views
14
Replies
1
Views
20
Replies
2
Views
38
Recommended Threads

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top