<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/every-obvious-approach-failed-building-an-async-database-client-sponsor-clickhouse--knjkaxtsk" -->

---
title: Every Obvious Approach Failed: Building an Async...
description: A ClickHouse engineer walks through the multi-year effort to build a truly async-native Python client for ClickHouse, explaining why naive approaches...
canonical: https://daily.dev/posts/every-obvious-approach-failed-building-an-async-database-client-sponsor-clickhouse--knjkaxtsk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Every Obvious Approach Failed: Building an Async Database Client...(Sponsor: Clickhouse) | daily.dev
og:description: A ClickHouse engineer walks through the multi-year effort to build a truly async-native Python client for ClickHouse, explaining why naive approaches...
og:url: https://daily.dev/posts/every-obvious-approach-failed-building-an-async-database-client-sponsor-clickhouse--knjkaxtsk
og:image: https://api.daily.dev/og/posts/KnjKaXtsk.png
og:image:alt: Every Obvious Approach Failed: Building an Async Database Client...(Sponsor: Clickhouse)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Every Obvious Approach Failed: Building an Async Database Client...(Sponsor: Clickhouse)

**[PyCon US](https://daily.dev/sources/pyconus)** · 69 min read · 0 upvotes · 0 comments

## Summary

A ClickHouse engineer walks through the multi-year effort to build a truly async-native Python client for ClickHouse, explaining why naive approaches (buffering full responses, parsing on the event loop, unbounded executor offloading) all failed to deliver real async benefits. The solution adopted is the half-sync/half-async pattern from a 1995 systems paper, splitting IO (async, event loop) from CPU-bound parsing (sync, worker thread) via a bounded queue bridge with careful lock-based wakeups, back pressure, and error propagation. Benchmarks show a 1.16x geometric mean throughput speedup, with P95 latency dropping from 882ms to 200ms and standard deviation shrinking dramatically under concurrent load, at parity with the old thread-pool-executor client at low concurrency.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=SIOSBYxLQmw>

## Questions this post answers

### Why does wrapping a synchronous database client in a thread pool executor fail to give real async performance benefits?

Wrapping a sync client in a thread pool executor gives async syntax but not async benefits because the entire request (HTTP call, byte reading, parsing, object building) runs as one opaque blocking unit inside a worker thread, with no point where another coroutine can run. Under low concurrency it performs fine, but under high concurrency each query holds a thread for its full duration, quickly draining the pool and blocking new requests.

_Anyone weighing thread-pool shortcuts against real async clients can track these architecture writeups on daily.dev._

### What is the half-sync half-async pattern and how does it apply to building an async database client?

Half-sync half-async is an architectural pattern from a 1995 paper by Schmidt and Cranor, originally seen in BSD Unix networking code, that separates synchronous and asynchronous work with a bridge, typically a bounded queue, connecting them. In ClickHouse Connect's Python client, the async side reads byte chunks from the server over the event loop while a synchronous worker thread parses them using the existing mature parser, with the bounded queue providing back pressure and preserving byte-stream order.

_Developers designing IO versus CPU splits for async clients can follow this kind of pattern breakdown on daily.dev._

### How much did rebuilding ClickHouse Connect as an async native client improve P95 latency and throughput?

The rewritten async native ClickHouse Connect client achieved about a 1.16x geometric mean throughput speedup across dozens of benchmark scenarios compared to the old thread-pool-executor based async client. More notably, P95 latency on an aggregation query dropped from roughly 882 milliseconds to 200 milliseconds, and standard deviation fell from about 1,600ms to 60ms, meaning results arrived faster and far more consistently under concurrent load.

_Teams benchmarking database client rewrites for tail latency gains can compare notes like this on daily.dev._

## Similar posts on daily.dev

- [Designing the new async-native ClickHouse Python client](https://daily.dev/posts/designing-the-new-async-native-clickhouse-python-client-0qyl5ea5w) · ClickHouse · 1 upvotes · 0 comments
- [Asynchronous I/O in DuckDB: Work, Thread, Work](https://daily.dev/posts/asynchronous-i-o-in-duckdb-work-thread-work-p1obh9kxz) · DuckDB · 3 upvotes · 0 comments
- [January 2026 newsletter](https://daily.dev/posts/january-2026-newsletter-e2rqw0nn1) · ClickHouse · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#clickhouse](https://daily.dev/tags/clickhouse)

[View this post on daily.dev](https://daily.dev/posts/every-obvious-approach-failed-building-an-async-database-client-sponsor-clickhouse--knjkaxtsk)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Every Obvious Approach Failed: Building an Async Database Client...(Sponsor: Clickhouse)","url":"https://daily.dev/posts/every-obvious-approach-failed-building-an-async-database-client-sponsor-clickhouse--knjkaxtsk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/every-obvious-approach-failed-building-an-async-database-client-sponsor-clickhouse--knjkaxtsk"},"datePublished":"2026-09-18T22:44:07.831Z","dateModified":"2026-09-18T22:44:34.013Z","description":"A ClickHouse engineer walks through the multi-year effort to build a truly async-native Python client for ClickHouse, explaining why naive approaches...","image":"https://i.ytimg.com/vi/SIOSBYxLQmw/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/SIOSBYxLQmw/sddefault.jpg","isAccessibleForFree":true,"articleSection":"PyCon US","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"PyCon US","logo":"https://media.daily.dev/image/upload/s--DLedNxG1--/f_auto,q_auto/v1777800767/logos/pyconus?_a=BAMAMiWQ0","url":"https://daily.dev/sources/pyconus"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/every-obvious-approach-failed-building-an-async-database-client-sponsor-clickhouse--knjkaxtsk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,clickhouse","timeRequired":"PT69M","video":{"@type":"VideoObject","name":"Every Obvious Approach Failed: Building an Async Database Client...(Sponsor: Clickhouse)","description":"A ClickHouse engineer walks through the multi-year effort to build a truly async-native Python client for ClickHouse, explaining why naive approaches...","thumbnailUrl":"https://i.ytimg.com/vi/SIOSBYxLQmw/sddefault.jpg","uploadDate":"2026-09-18T22:44:07.831Z","duration":"PT69M","url":"https://api.daily.dev/r/KnjKaXtsk","embedUrl":"https://www.youtube.com/embed/SIOSBYxLQmw"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"PyCon US","item":"https://daily.dev/sources/pyconus"},{"@type":"ListItem","position":3,"name":"Every Obvious Approach Failed: Building an Async Database Client...(Sponsor: Clickhouse)"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/every-obvious-approach-failed-building-an-async-database-client-sponsor-clickhouse--knjkaxtsk#faq","mainEntity":[{"@type":"Question","name":"Why does wrapping a synchronous database client in a thread pool executor fail to give real async performance benefits?","acceptedAnswer":{"@type":"Answer","text":"Wrapping a sync client in a thread pool executor gives async syntax but not async benefits because the entire request (HTTP call, byte reading, parsing, object building) runs as one opaque blocking unit inside a worker thread, with no point where another coroutine can run. Under low concurrency it performs fine, but under high concurrency each query holds a thread for its full duration, quickly draining the pool and blocking new requests. Anyone weighing thread-pool shortcuts against real async clients can track these architecture writeups on daily.dev."}},{"@type":"Question","name":"What is the half-sync half-async pattern and how does it apply to building an async database client?","acceptedAnswer":{"@type":"Answer","text":"Half-sync half-async is an architectural pattern from a 1995 paper by Schmidt and Cranor, originally seen in BSD Unix networking code, that separates synchronous and asynchronous work with a bridge, typically a bounded queue, connecting them. In ClickHouse Connect's Python client, the async side reads byte chunks from the server over the event loop while a synchronous worker thread parses them using the existing mature parser, with the bounded queue providing back pressure and preserving byte-stream order. Developers designing IO versus CPU splits for async clients can follow this kind of pattern breakdown on daily.dev."}},{"@type":"Question","name":"How much did rebuilding ClickHouse Connect as an async native client improve P95 latency and throughput?","acceptedAnswer":{"@type":"Answer","text":"The rewritten async native ClickHouse Connect client achieved about a 1.16x geometric mean throughput speedup across dozens of benchmark scenarios compared to the old thread-pool-executor based async client. More notably, P95 latency on an aggregation query dropped from roughly 882 milliseconds to 200 milliseconds, and standard deviation fell from about 1,600ms to 60ms, meaning results arrived faster and far more consistently under concurrent load. Teams benchmarking database client rewrites for tail latency gains can compare notes like this on daily.dev."}}]}
```

