Reputation: 66490
I have queries that return thousands of results, is it posible to show only query time without actual results in MySQL console or from command line?
Upvotes: 15
Views: 5616
Reputation: 7905
If you're using Linux.
select * from table1
time mysql your_db_name -u'db_user_name' -p'your_password' < query.sql > /dev/null
The output will look something like this:
real 0m4.383s
user 0m0.022s
sys 0m0.004s
the "real" line is what you're looking at. In the above example, the query took 4.38 seconds.
Obviously, entering your DB password on the command line is not such a great idea, but will do as a quick and dirty workaround.
Upvotes: 5
Reputation: 20745
Use SET profiling = 1;
at command prompt.
It's not possible to get the execution time without getting result or getting sql executed.
See why we can not get execution time without actual query execution
Upvotes: 7