1. SELECT * against a wide table
Symptom
The query reads hundreds of gigabytes to aggregate two columns.
The pattern
SELECT * FROM events WHERE event_date >= today() - 7;Why it bites
ClickHouse stores each column separately, so cost is proportional to the columns you name. `SELECT *` forfeits the entire point of a columnar store — on a 200-column events table it reads a hundred times more data than the aggregate needs.
The fix
SELECT event_date, count() AS events
FROM events
WHERE event_date >= today() - 7
GROUP BY event_date;