CODE WORKSPACE

Wide-scan efficiency

Return query_id, query_label, and gb_per_partition (gb_scanned divided by partitions_scanned, as a 2-decimal string). Order by the numeric ratio descending, then query_id.

Divide gb_scanned by partitions_scanned in decimal math, then format the ratio.

Sample input

query_runsgb_scanned divided by partitions_scanned approximates bytes read per partition.
query_idquery_labelgb_scannedpartitions_scanned
1daily_active_users128
2orders_export2408
3revenue_by_country32
4event_funnel856
5late_event_audit61
6adhoc_select_star1808

Expected output

Expected outputBytes scanned per partition, highest first — the wide SELECT-* scans on top.
query_idquery_labelgb_per_partition
2orders_export30.00
6adhoc_select_star22.50
4event_funnel14.17
5late_event_audit6.00
1daily_active_users1.50
3revenue_by_country1.50

Constraints

Force decimal math with gb_scanned * 1.0 / partitions_scanned, then format with printf('%.2f', ...). Order by the numeric ratio DESC, query_id ASC.

Expected skills

Per-partition scan efficiency and decimal-safe ratio formatting.

SQL
Loading...

AI evaluation

Run the SQL query to inspect preview rows.