Query Cost Isolation Under Shared Multi-Region SQL Joins
Signal date: 2026-10-14Prepared for Hannah at PostHog (posthog.com)
Self-serve SQL joins across external billing tables and raw event partitions raise scan variance sharply when heavy tenants share ClickHouse compute pools. The patterns below focus on isolating wide-scan workloads before they erode event margins.
Two Concrete Bottleneck Paths
Unbounded cross-source joins exhausting shared memory pools
Ad-hoc joins between external synced tables and unpartitioned event ranges trigger broad granule reads that spike tail latency for neighboring accounts.
Why here: Warehouse SQL supports arbitrary joins across synced CRM and Stripe tables inside the same analytical tier.
Cross-region backfill retries inflating storage and compute burn
Incremental sync replays across US and EU clusters duplicate part merges when schema drift causes silent retry loops overnight.
Why here: Dual-region operation across US and EU clouds doubles merge overhead whenever external connectors change schemas.
Three Practical Controls
Per-tenant read-byte budgets with automatic pool spillover
Route queries projected above 50 GB scanned into an isolated low-priority pool with strict memory limits before execution.
Pre-execution partition pruning validator on external joins
Require time-bound predicates on event tables joined against external tables and surface estimated scan cost prior to run.
Idempotent sync checkpointing with schema-diff circuit breakers
Pause connector retries after two identical schema mismatch failures and emit structured margin alerts per cluster.
Internal Diagnostic Questions
- 1.What share of monthly ClickHouse compute spend currently comes from the top 5 percent of warehouse SQL tenants?
- 2.Do ad-hoc joins against synced external tables execute on the same worker pool as core funnel dashboards?
- 3.How quickly can engineering detect a silent connector retry loop before it triggers redundant part merges?