= Getting basic database size-data in Clickhouse =

Run the following query:

SELECT
    name,
    engine,
    formatReadableQuantity(total_rows) AS rows,
    formatReadableSize(total_bytes) AS size,
    active_parts
FROM system.tables
WHERE (database = 'my_database') AND (engine != 'MaterializedView') AND (engine != 'Dictionary')

Query id: c9fa08eb-4be1-404e-b6b8-3539b66c6e26

   ┌─name────────────────┬─engine───────────────┬─rows───────────┬─size───────┬─active_parts─┐
1. │ demand_daily__agg   │ AggregatingMergeTree │ 6.87 billion   │ 56.15 GiB  │           35 │
2. │ demand_hourly__agg  │ AggregatingMergeTree │ 61.18 billion  │ 371.20 GiB │         1058 │
3. │ dsp_daily__agg      │ AggregatingMergeTree │ 643.29 million │ 8.19 GiB   │           29 │
4. │ raw_event_data_2    │ MergeTree            │ 182.23 billion │ 3.44 TiB   │          281 │
5. │ partners_api_hourly │ ReplacingMergeTree   │ 14.25 thousand │ 892.20 KiB │          317 │
6. │ processed_files     │ ReplacingMergeTree   │ 30.43 million  │ 429.89 MiB │          137 │
7. │ raw_event_data_2    │ MergeTree            │ 4.34 billion   │ 130.95 GiB │          182 │
8. │ supply_daily__agg   │ AggregatingMergeTree │ 1.68 billion   │ 21.61 GiB  │           29 │
9. │ supply_hourly__agg  │ AggregatingMergeTree │ 16.91 billion  │ 162.64 GiB │          915 │
   └─────────────────────┴──────────────────────┴────────────────┴────────────┴──────────────┘

9 rows in set. Elapsed: 0.002 sec.

= References =

  • Nothing here.