4

I have run the query in mysql which consists of approximately 33million records when i have executed the query

  • select population1 < 200000 from city; it shows like this after execution

34459393 rows in set (16.04 sec)

My question is what is 16.04 sec because in normal time it has taken morethan 30min but it shows 16.04 sec. How can i calculate the actual time.

  • I am not sure select population1 < 200000 from city is correct or not ? It should be SELECT Col_name from City WHERE population1 < 200000 . – Abdul Manaf Jul 22 '14 at 15:25
4

The 16.04 seconds is a timer on the client that measures the amount of time that passed between the call and the execution of the query (if you want to be more specific than that, the wall clock time between calling start_timer() and mysql_end_timer(), something that can lead to hilarious results like this one I got).

The reason that you think that it took you more than 30 minutes to execute is probably because it doesn't have into account the output to the stdout. You can check that it really takes 16 second by doing:

mysql> pager cat > /dev/null 
mysql> <your query here>
mysql> nopager

If you want to measure how much time takes to write to the standard output, you can do:

$ time mysql -u <your user> -p<your password> <your database> \
  -e "select population1 < 200000 from city"

Note: Are you sure you want to print a 0 or a 1 for ALL rows from that table? Maybe the option --safe-updates and/or using a GUI can help you a bit with your queries?

  • i just want to see execution time and the output is not mandatory for me. – user41498 Jul 23 '14 at 4:19
0

When you run a query in MySQL Workbench you get actually 2 times in the action output window. The headeing also shows what they are for:

enter image description here

There's the execution time on the server (which is probably your ~16s) and the, usually much larger, fetch time, to transport the data from the server to the client. With millions of records that can easily take minutes or more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.