Skip to content

Commit

Permalink
Add basic ops query to check size of tables in Clickhouse
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed Apr 18, 2024
1 parent 87b7bba commit 0bd173d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion HelmChart/Docs/Clickhouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,27 @@ then you should be able to access from the localhost and port 8123
kubectl get secret/oneuptime-clickhouse -o go-template='{{(index .data "admin-password") | base64decode}}'
```

Important: Please ignore % in the end of the password output.
Important: Please ignore % in the end of the password output.


### Basic Ops Queries


#### Check Size of Tables in Clickhouse

```sql
SELECT
database,
table,
formatReadableSize(sum(data_compressed_bytes) AS size) AS compressed,
formatReadableSize(sum(data_uncompressed_bytes) AS usize) AS uncompressed,
round(usize / size, 2) AS compr_rate,
sum(rows) AS rows,
count() AS part_count
FROM system.parts
WHERE (active = 1) AND (database LIKE '%') AND (table LIKE '%')
GROUP BY
database,
table
ORDER BY size DESC;
```

0 comments on commit 0bd173d

Please sign in to comment.