You've spotted an important point! The official ClickHouse documentation example you referenced does indeed show ORDER BY tuple() for a time-series table, which seems contradictory to best practices. Let me explain why they might use this and clarify the nuances:
Why the Documentation Uses ORDER BY tuple() in That Example
Simplification for demonstration:
The example focuses specifically on DateTime data types, not table optimization
ORDER BY tuple() creates the simplest possible table structure to demonstrate timestamp storage
It avoids distracting readers with indexing concepts during a data type tutorial
Special case for extremely simple tables:
When a table has only one column (like their temperature example), ORDER BY tuple() might be acceptable
But your table has two columns (timestamp and fps), so this doesn't apply
"Dummy" primary key requirement:
MergeTree tables require an ORDER BY clause
tuple() satisfies this requirement syntactically without defining a real key
The Critical Problem With This Approach
While valid syntactically, ORDER BY tuple() is terrible for actual time-series workloads because:
Zero query optimization:
sql
SELECT * FROM fps WHERE timestamp > now() - INTERVAL 1 HOUR
Will perform full table scans every time, even for small time ranges
No data skipping:
ClickHouse can't eliminate data parts using minmax indexes since there's no ordering dimension
Wasted storage:
Without proper ordering, similar timestamps aren't colocated, reducing compression efficiency
What You Should Do Instead
For your table with (timestamp, fps):
sql
CREATE TABLE proxy_analytics.fps
(
timestamp DateTime MATERIALIZED now(),
fps Float32
)
ENGINE = MergeTree
ORDER BY (timestamp) -- Critical for time-series!
Why This Matters in Practice
Query Pattern
ORDER BY tuple()
ORDER BY timestamp
WHERE timestamp > X
Full scan
Parts skipped
ORDER BY timestamp
Slow in-memory sort
Direct read
GROUP BY toStartOfHour(timestamp)
Slow
Optimized
Disk space usage
~100%
~60-80% (better compression)
Documentation Context
The example appears in the "DateTime data types" section, not the general time-series optimization guide. Later sections like "Storing Time-series Data Efficiently" show proper ORDER BY (timestamp) usage.
Conclusion
While ORDER BY tuple() works syntactically, it's only suitable for:
Example/demo tables
Tiny lookup tables (<10k rows)
Tables only used for bulk inserts with no queries
For any real time-series table like your FPS metrics:
sql
ENGINE = MergeTree ORDER BY (timestamp)
Is mandatory for performance. The documentation uses tuple() as a placeholder to simplify the specific data type example, not as a general recommendation.