APPENDIX · P3 · PARTS · FOR SLIDE 14
← Back to Slide 14
P3. Table segments and partitions
SELECT partition, count() AS parts,
sum(rows) AS rows, sum(marks) AS marks
FROM system.parts
WHERE database = currentDatabase() AND table = 'events'
AND active
GROUP BY partition
ORDER BY partition;
What the result should be
partition parts rows marks
202608 1 2540527 312
202609 1 2459473 302
202610 1 100000 13
Partition — month
Tag ≈ 8,192 lines
October — one INSERT
toYYYYMM(ts): Parts of different months never overlap.
312 tags across 2.54 million lines. The index discards the granules between tags, not the lines.
100,000 rows in a single batch—one part. 100,000 individual INSERT statements would result in “too many parts.”
There are more parts in the working table: merges are happening in the background. The fact that there is one part per partition here is a result of the `OPTIMIZE FINAL` command in the tutorial scenario.