1 · INTERNALS · PARTITIONS
Partitions: groups of sections
One table — monthly breakdown
partition pruning
PARTITION BY toYYYYMM(ts)
-- 5 млн строк за август–сентябрь:
202608_2_2_0 565 159 строк
202608_4_4_0 565 374
…
202609_1_1_0 546 794
202609_3_3_0 546 579
… -- 10 частей, 2 партиции
EXPLAIN indexes = 1
SELECT count() FROM events
WHERE ts >= '2026-09-10'
AND ts < '2026-09-11';
-- Min-Max Parts 1/2 Granules 301/612
-- PrimaryKey Granules 27/301
WHY
INQUIRIES
HOW MUCH
Data Management
They don't always help
A little
DROP PARTITION, TTL, and moving entire partitions to a lower-cost disk without rewriting data.
Only when filtering by partition key. Queries on all partitions are slower.
Mergers only within a partition. Documentation: up to ~1,000–10,000 values.
A partition is used for data management, not for speed. Speed comes from the ORDER BY clause.