Last active
September 27, 2022 08:21
-
-
Save kalkov/e63fe1bfac2e72ccda22e1b7570a0978 to your computer and use it in GitHub Desktop.
Handy Clickhouse queries
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
SELECT | |
table, | |
formatReadableSize(sum(bytes)) AS size, | |
min(min_date) AS min_date, | |
max(max_date) AS max_date | |
FROM system.parts | |
WHERE active | |
GROUP BY table | |
ORDER BY sum(bytes) DESC |
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
SELECT | |
table, | |
formatReadableSize(sum(bytes)) AS size, | |
min(min_date) AS min_date, | |
max(max_date) AS max_date | |
FROM system.parts | |
WHERE active AND (table NOT LIKE '.inner%') AND (table NOT LIKE '_tmp%') | |
GROUP BY table | |
ORDER BY sum(bytes) DESC |
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
SELECT database, table FROM system.tables where table like '%test%' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment