GCP

BigQuery INFOMATION_SCHEMA まとめ

テーブル基本情報取得

SELECT * FROM `プロジェクト名.データセット名.INFOMATION_SCHEMA.TABLES`

現在クエリ実行中のユーザークエリ数

SELECT user_email,state,count(*) cnt,sum(period_slot_ms) period_slot_ms
FROM `プロジェクト名.region-asia-northeast1`.INFOMATION_SCHEMA.JOBS_TIME_LINE
WHERE state = ‘RUNNING’
AND job_vreation_time >= “2023-xx0xx”
AND CAST(DATETIME(period_start,”Japan”) AS STRING) = “2023-xx-xx xx:xx:xx”
GROUP BY 1,2
ORDER BY period_slot_ms DESC