3 · IN THE PROJECT · ERRORS
common mistakes in projects
ERROR 1
ERROR 2
ERROR 3
ClickHouse as an OLTP System
We're waiting for FK and UNIQUE
INSERT by row
Order status, balance, and inventory with an UPDATE for every action. The updates are resource-intensive; there are no transactions.
The PRIMARY KEY is not unique, and there are no foreign keys. The conditions “The player exists” and “one row per match” are checked during the load or query.
Service cycle: event — INSERT. Thousands of parts and "too many parts." Batches or async_insert.
→ slides 16, 22
→ slides 11, 15
→ slides 8, 14
ERROR 4
ERROR 5
ERROR 6
double counting in MV
PARTITION BY player_id
Nullable and String Everywhere
Repeating a batch after a retry doubles the sum. The deduplication window applies to both tables; the batch ID.
Hundreds of thousands of partitions and segments. A partition is used for data management over time; a segment is used in an ORDER BY clause.
The unnecessary NULL mask, strings instead of LowCardinality, and Int64 "just in case"—all of these waste bytes and time.
→ slide 18
→ slides 9, 12
→ slide 12
All six errors are visible in the DDL and the load code even before the first query. Check for them during the schema review—just as you did with FKs and CHECK constraints in Lesson 2.