Skip to content

Instantly share code, notes, and snippets.

@mshakhomirov
Last active July 20, 2023 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshakhomirov/e4a474274cdce814a9f92e6d6a406939 to your computer and use it in GitHub Desktop.
Save mshakhomirov/e4a474274cdce814a9f92e6d6a406939 to your computer and use it in GitHub Desktop.
with d as (



SELECT
  user_email,
  query,
  SUM(total_bytes_billed) AS bytes_billed
FROM
  `region-us`.INFORMATION_SCHEMA.JOBS
WHERE
  job_type = 'QUERY'
  -- AND statement_type != 'SCRIPT'

and
            date(creation_time) >= PARSE_DATE('%Y%m%d', '20230718')
            and             date(creation_time) <= PARSE_DATE('%Y%m%d', '20230718')
GROUP BY
  user_email, query
)
select 
user_email,
query,
bytes_billed / 1000000000000 tb,
bytes_billed / 1000000000000 * 5 as cost_usd
from d
order by 2 desc
with d as (



SELECT
  user_email,
  query,
  SUM(total_bytes_billed) AS bytes_billed,
  count(*) query_cnt
FROM
  `region-us`.INFORMATION_SCHEMA.JOBS
WHERE
  job_type = 'QUERY'
  -- AND statement_type != 'SCRIPT'

and
            date(creation_time) >= PARSE_DATE('%Y%m%d', '20230718')
            and             date(creation_time) <= PARSE_DATE('%Y%m%d', '20230718')
GROUP BY
  user_email, query
)
select 
user_email,
query,
query_cnt,
bytes_billed / 1000000000000 tb,
bytes_billed / 1000000000000 * 5 as cost_usd
from d
where user_email like  '%sise%'
order by 5 desc

Doors

Baby room : 2.04 x 0.82 Living room: 2.04 x 0.82 Cupboard: 2.04 x 0.63; 2.04 x 0.63; Bathroom big: 2.04 x 0.82 Bedroom: 2.04 x 0.82 Heating room: 2.04 x 0.63 Ensuite bathroom: 2.04 x 0.73 Entrance door: 2.04 x 0.82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment