Why elapsed time is less than the slot time consumed in bigquery

Viewed 228

I have gone through many of the google cloud blogs and bigquery documentation to understand what is elapsed time and slot time consumed in bigquery. Here I had run one query which has the following output

enter image description here

From this answer , 'elapsed time' is total time taken by BQ to execute your query. 'slot time' is the total time taken by vCPUs to execute your query. I still had a doubt about how the total time of the query is lesser than CPU time of the query if my understanding was correct. I have gone through this blog. Still didn't get the clarity. Since everywhere slot time will be described as the CPU and other resources metric, can I take this metric as CPU time spent by this query ?

2 Answers

Check below naive and super simple analogy - hope it helps to clear things a little

You hired 10 workers - they worked as a team for 1 hour

While for you work looked like was done in a one hour - in reality there were 10 man/hours spent

So the 1 hour you see - is elapsed time or total query time
While 10 hours is - slot time consumed or CPU time

The slot time typically exceeds the elapsed time as there are many workers involved in executing a query in bigquery. Each worker spends slot time. For example, a dozen workers at 50% CPU, as they are also doing I/O, can spend 6 seconds of slot time per second of elapsed time.

The docs reference "workers in parralel".

Many of my queries run less than a minute of elapsed time and use over an hour of slot time.

Related