To obtain a list of tables that somehow store any data it is important to exclude Kafka and Materialized views (those are just proxies for various data sources and are not meant to be queried directly).
SELECT name AS table_name, engine, total_rows FROM system.tables WHERE database = 'statistics' AND engine not in ('MaterializedView', 'Kafka') ORDER BY table_name;There are 2 types of tables in the statistics database:
MergeTree- tables storing data in a non-aggregated form. These tables are used for storing raw data and are rarely queriedSummingMergeTree- tables storing data in an aggregated form. In a contrast toMergeTreetables, these tables are queried frequently and are used for generating reports and dashboards.
Tables cleanup
Some of raw data tables can grow significantly over time and may require cleanup:
- messagecallbackevents
- message_events