 -- https://cloud.google.com/bigquery/docs/information-schema-jobs
 
 -- Compute the cost per Job, Average slots per Job and Max slots per Job (at the job stage level)
--- This will show you the cost for the Query and the Maximum number of slots used (to help gauge for reservations)
+-- This will show you the cost for the Query and the Maximum number of slots used and if any additional slots where requested (to help gauge for reservations)
 SELECT project_id,
        job_id,
        reservation_id,

       job_type,
       user_email,
       total_bytes_billed,
       -- 5 / 1,099,511,627,776 = 0.00000000000454747350886464 ($5 per TB so cost per byte is 0.00000000000454747350886464)
       CAST(total_bytes_billed AS BIGDECIMAL) * CAST(0.00000000000454747350886464 AS BIGDECIMAL) as est_cost,
       -- Average slot utilization per job is calculated by dividing
       -- total_slot_ms by the millisecond duration of the job
       SAFE_DIVIDE(total_slot_ms,(TIMESTAMP_DIFF(end_time, start_time, MILLISECOND))) AS job_avg_slots,
       query,
       MAX(SAFE_DIVIDE(unnest_job_stages.slot_ms,unnest_job_stages.end_ms - unnest_job_stages.start_ms)) AS jobstage_max_slots
  FROM `region-${bigquery_region}`.INFORMATION_SCHEMA.JOBS
       CROSS JOIN UNNEST(job_stages) as unnest_job_stages
 WHERE project_id = '${project_id}'
 GROUP BY 1,2,3,4,5,6,7,8,9,10,11
ORDER BY job_id ;



-- https://cloud.google.com/bigquery/docs/information-schema-jobs

-- Compute the cost per Job, Average slots per Job and Max slots per Job (at the job stage level)
-- This will show you the cost for the Query and the Maximum number of slots used and if any additional slots where requested (to help gauge for reservations)
SELECT project_id,
       job_id,
       reservation_id,
