Skip to content

Instantly share code, notes, and snippets.

View VincentAntoine's full-sized avatar

Vincent Chéry VincentAntoine

View GitHub Profile
@VincentAntoine
VincentAntoine / timescaledb_tables_and_hypertables_sizes.sql
Last active August 28, 2022 23:08
Query to list all tables and hypertables in a Postgresql / TimescaleDB database with their total size
WITH chunks AS (
SELECT
ht.schema_name AS hypertable_schema,
ht.table_name AS hypertable_name,
ck.table_name AS chunk_name
FROM _timescaledb_catalog.hypertable ht
JOIN _timescaledb_catalog.chunk ck
ON ht.id = ck.hypertable_id
),