Setting the file. One moment.
Chapter 04 · Clickhouse Best Practices
Subchapter 4.27
rules/schema-partition-start-without.mdMarkdown1 KBView on GitHub
Impact: MEDIUM
Start without partitioning and add it later only if:
Example (start simple):
-- Start simple, no partitioning
CREATE TABLE events (
timestamp DateTime,
event_type LowCardinality(String),
user_id UInt64
)
ENGINE = MergeTree()
ORDER BY (event_type, timestamp);
-- Add partitioning later if needed for lifecycle management
-- (requires table recreation or materialized view migration)When to add partitioning:
| Need | Add Partitioning? |
|---|---|
| Time-based data retention | Yes |
| Archive old data to cold storage | Yes |
| Query performance on time ranges | Maybe (test first) |
| No specific lifecycle needs | No |