在google-bigquery中,如何按大小排列表格列表?

Man*_*lan 5 google-bigquery

我需要按大小列出数据集顺序中的所有BQ表,以找出占用更多空间的表.怎么做到这一点?

谢谢!

Mik*_*ant 8

#standardSQL
SELECT table_id,
    DATE(TIMESTAMP_MILLIS(creation_time)) AS creation_date,
    DATE(TIMESTAMP_MILLIS(last_modified_time)) AS last_modified_date,
    row_count,
    size_bytes,
    CASE
        WHEN type = 1 THEN 'table'
        WHEN type = 2 THEN 'view'
        WHEN type = 3 THEN 'external'
        ELSE '?'
    END AS type,
    TIMESTAMP_MILLIS(creation_time) AS creation_time,
    TIMESTAMP_MILLIS(last_modified_time) AS last_modified_time,
    dataset_id,
    project_id
FROM `yourProject.yourDataset.__TABLES__`
ORDER BY size_bytes DESC  
Run Code Online (Sandbox Code Playgroud)

以上查询为您提供的不仅仅是尺寸 - 享受:o)