5 gotchas I hit moving LLM logs from Postgres to ClickHouse
The article discusses the author's experience migrating LLM logs from Postgres to ClickHouse for better performance. It highlights the challenges faced during the migration and the reasons for choosing ClickHouse over other database solutions. The author shares five key issues encountered and the architectural decisions made to ensure data integrity and efficient querying.
- ▪The author built Spanlens, an open-source LLM observability platform that records API calls with detailed metrics.
- ▪Postgres struggled with performance as the requests table grew, prompting the migration to ClickHouse.
- ▪ClickHouse was chosen for its efficient columnar compression and suitability for insert-heavy workloads.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3954268) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } SPANLENS Posted on May 27 5 gotchas I hit moving LLM logs from Postgres to ClickHouse #clickhouse #opensource #typescript #postgres The problem I am building Spanlens, an open-source LLM observability platform. Every call to OpenAI, Anthropic, or Gemini gets recorded with its model, latency, tokens, cost, and full request and response body. At low traffic on Supabase Postgres this was fine, but I could already see a few signs that this specific table would not stay fine for long.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).