Search terms: schema design, ORDER BY, PRIMARY KEY, PARTITION BY, data types, TTL, indexgranularity
| MergeTree | Append-only data (events, logs) | Standard storage, no special merge logic | | ReplacingMergeTree | Deduplication, upserts | Keeps latest row per ORDER BY key; query with argMax pattern | | SummingMergeTree | Pre-aggregated counters | Automatically sums numeric columns on merge |
| AggregatingMergeTree | Complex aggregates (uniq, quantile) | Stores intermediate states; use -State/-Merge functions | | CollapsingMergeTree | Mutable rows | Uses +1/-1 sign column to cancel/update rows |
Oltre 15 regole dello schema per le tabelle ClickHouse. CARICARE SEMPRE durante la creazione o la modifica delle tabelle. Ottiene query inferiori al secondo, compressione 10x e ciclo di vita dei dati automatizzato. Fonte: obsessiondb/clickhouse-plugin.