Skip to content

Instantly share code, notes, and snippets.

@meysampg
Created February 3, 2023 08:29
Show Gist options
  • Save meysampg/0af394e7d06ad35dd1e56bd4f43e3b22 to your computer and use it in GitHub Desktop.
Save meysampg/0af394e7d06ad35dd1e56bd4f43e3b22 to your computer and use it in GitHub Desktop.
Information of druid segments for a given data source
SELECT
"start",
"end",
version,
COUNT(*) AS num_segments,
AVG("num_rows") AS avg_num_rows,
MIN("num_rows") AS min_num_rows,
max("num_rows") AS max_num_rows,
SUM("num_rows") AS total_num_rows,
MIN("size") / 1024 / 1024 AS min_size,
MAX("size") / 1024 / 1024 AS max_size,
AVG("size") / 1024 / 1024 AS avg_size,
SUM("size") / 1024 / 1024 AS total_size,
MAX("partition_num") AS partitions_count
FROM
sys.segments A
WHERE
datasource = '<DATA_SOURCE_NAME>'
AND is_published = 1
-- AND is_realtime = 1
GROUP BY 1, 2, 3
ORDER BY 1, 2, 3 DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment