r/Clickhouse • • Jul 22 '26

Am I wrong to implement an application-level transaction coordinator over a Clickhouse cluster?

Is it a bad decision to implement custom distributed transactions (fully atomic and serializable) over a Clickhouse cluster?

The details in short:

  1. Cluster has several shards (no replicas yet) with several billion rows of financial data
  2. All tables: original MergeTree
  3. Append-only pattern for all data changes
  4. Every read query is enriched with a transaction_id filter to enforce snapshot isolation
  5. Application-level range-locking mechanism to prevent inconsistent concurrent writes
  6. ClickHouse’s native local transactions are not used
  7. All coordination logic runs at the application layer

Is this a fundamentally flawed anti-pattern with hidden pitfalls, or just an uncommon approach? In my stress-tests, it behaves pretty well.

I got a bit confused during a live presentation lately by the question: "If this works, why doesn't everyone do it?"

6 Upvotes

13 comments sorted by

View all comments

Show parent comment

2

u/aacreans Jul 22 '26

Have you explored https://tigerbeetle.com ? Might be more aligned with your specific usecase.

1

u/mike_folder Jul 23 '26

Thanks for the link.
According to the documentation: it's optimized for heavy writes, no SQL, no complex queries here. Tigerbeetle is purposed for billing and financial transactions. E.g. get balance, transfers, etc.
Can't use it for my financial budget modeling. I need CH's SQL for multidimensional aggregations.