SQL

Queries

Reports with Highest Data Usage

This query returns the top 10 reports in your workspace with the highest all-time data usage.

SELECT
  r.id AS report_id,
  r.name AS report_name,
  r.collection_name,
  COALESCE(SUM(qr.bytes) / (1000 * 1000 * 1000), 0) AS data_usage_gb,
  COUNT(qr.id) AS successful_query_runs
FROM organization_usage.query_runs qr
JOIN organization_usage.queries q
  ON q.id = qr.query_id
JOIN organization_usage.reports r
  ON r.id = q.report_id
WHERE qr.state = 'succeeded'
GROUP BY 1,2,3
ORDER BY 4 DESC
LIMIT 10