Hidden Bottleneck in ClickHouse Query Planning Identified by Cloudflare
Cloudflare traced a major slowdown in its billing pipeline to hidden lock contention inside ClickHouse’s query planning layer after a partitioning change altered execution behavior at scale. Traditional database metrics did not clearly expose the issue, which was ultimately identified using flame graph analysis. The fix involved replacing an exclusive lock with a shared lock in the query planner to reduce contention under heavy concurrency.











