Created
October 17, 2023 19:56
-
-
Save tom-clickhouse/1435eba5e76701bee00a9145f40aec79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
'pypi' AS db_name, | |
'pypi' AS table_name, | |
( | |
SELECT uuid | |
FROM system.tables | |
WHERE (database = db_name) AND (name = table_name) | |
) AS table_id | |
SELECT | |
DENSE_RANK() OVER(ORDER BY hostName()) AS n, | |
formatReadableQuantity(countIf(event_type = 'NewPart')) AS parts, | |
formatReadableQuantity(sumIf(rows, event_type = 'NewPart')) AS rows_total | |
FROM clusterAllReplicas(default, system.part_log) | |
WHERE table_uuid = table_id | |
GROUP BY hostName() WITH Totals | |
ORDER BY n | |
SETTINGS skip_unavailable_shards = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment