Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CPU Time vs Elapsed Time in T-SQL [closed]

From what I've read (please correct me on any of these points if I'm wrong);

  • CPU time is the time that the CPU is used (i.e. without the delays caused by other resources)

  • Elapsed time is the wall clock time (the amount of time taken to execute the operation regardless of any resource delays or multiple threads etc.)

  • Elapsed time is generally higher than CPU time with the exception of a multi processor environment

Assuming that the time taken by all my resources such as I/O is 0

Can I say that CPU Time divided by # of cores <= Elapsed time ?

like image 256
Nandun Avatar asked Nov 10 '22 13:11

Nandun


1 Answers

By definition, elapsed time will be less than CPU time divided by number of cores if one core has to wait and/or takes more CPU time than another core. If all cores use the same CPU and have zero wait, then elapsed time will be the same as CPU time divided by number of cores. I can't see how it could ever be lower.

like image 186
SAS Avatar answered Nov 15 '22 06:11

SAS