-
-
Save tom-clickhouse/f9c683945ea805062f7f5f63bf8b1389 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 | |
'default' AS db_name, | |
'wikistat' 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