Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 10 min read Deep dive mediumAdept

@clickhouse/rowbinary: when your library is also a parser compiler

@clickhouse/rowbinary is a Node.js reader/writer for ClickHouse's RowBinary formats that also ships as an Agent Skill: a coding agent reads its densely commented, monomorphizable primitives plus SKILL.md and generates a parser specialized to a query's exact column types, replacing a traditional codegen compiler. Generated parsers ran 1.5–3.4x faster than composing the library API (e.g. one bounds check and constant-offset reads for fixed-width rows, avoiding V8 megamorphic dispatch), and RowBinary itself beat the correct BigInt-safe JSON path by 2.1–3.3x on numeric schemas, though JSONCompactEachRow wins on string-heavy data. Each parser costs about $0.20 to generate with Claude Sonnet 4.6, and grounding the agent in tested primitives avoids silent bugs such as byte-order-wrong UUID decoding that models produced from memory in 3 of 5 runs.

Related posts

  • Building a code search engine with Turso

    Turso mediumAdept

    Codemogger is an open-source code indexer and search engine for AI agents, built on a single local Turso (SQLite-compatible) file using native vector columns and full-text search. Tree-sitter splits code into function and struct chunks, which are embedded locally with all-MiniLM-L6-v2 and stored as int8-quantized vector8(384) columns (395 vs 1,536 bytes per vector). Brute-force cosine search over 40,000 TypeScript compiler chunks takes about 240ms on an M2, and BM25 keyword search with name/signature weights takes 1-4ms. Results are merged with Reciprocal Rank Fusion (0.6 vector, 0.4 FTS), and a TypeScript SDK accepts any embedding function and indexes incrementally by file hash.

  • ClickHouse Input format matchup: Which is fastest & most efficient

    ClickHouse mediumAdept

    FastFormats is a benchmark that measures ClickHouse server-side ingestion time and hardware efficiency across roughly 60 input formats, crossed with batch size, pre-sorting and compression, using the ClickBench web analytics dataset over the HTTP interface. With 10k-row batches and LZ4 compression, the Native format was fastest: 131s for 2.55 GiB. That beat ArrowStream by 10%, RowBinary by 18%, TSV and Parquet by about 31–32%, CSV by 36%, and JSONEachRow by 51%, because its columnar layout closely matches MergeTree. Format choice has the biggest impact, followed by compression, while pre-sorting helps only in specific cases. Native is recommended unless the table DDL uses format-specific MATERIALIZED/DEFAULT expressions.

  • The world’s fastest tool for querying JSON files

    ClickHouse easyNovice

    clickhouse-local, a single-binary SQL engine for local and remote files, outperforms SPySQL, jq, trdsql, Miller, OctoSQL, spark-sql, Pandas and DSQ when querying large JSON files in the SPySQL benchmark on Amazon book reviews data. The benchmark covers map (computed column over all rows), aggregation (column average) and filter (first 100 matching rows) tasks, and OctoSQL is faster on smaller files. Schema inference and semi-structured data support make the queries simple to write. Caveats: each query runs only once, results vary by hardware, and the filter test favors tools that stop early on LIMIT without loading the whole file.

  • Ghostwriter AI & Complete Code Beta

    Replit mediumAdept

    Replit's Ghostwriter adds AI code completion, generation, transformation, explanation and semantic search to its IDE, with Complete Code starting in closed beta. Completion is built on Salesforce's CodeGen, converted to FasterTransformer and served on Triton, with a 2B model distilled to about 1B parameters and int8 quantization under exploration, for a median latency under 400ms. On the editor side, suggestions are matched against existing whitespace, braces and AST structure, adjusted as the user keeps typing, filtered by heuristics and streamed line by line. Other features use a 'society of models': a fine-tuned CodeBERT embedding model for contextual natural-language code search, and large OpenAI and 100B+ parameter models for explaining, generating and transforming code.

  • Executable UDFs are now generally available on ClickHouse Cloud

    ClickHouse mediumAdept

    Executable UDFs are now generally available on ClickHouse Cloud across AWS, GCP and Azure, adding a Native runtime for statically linked Rust/Go/C++/JavaScript binaries, outbound network access, per-process memory limits, a deterministic flag that enables the query cache, Cloud API and Terraform support, and per-query UDF metrics in 26.6+. The worked example is a Rust tokenizer UDF built on tiktoken-rs that speaks RowBinary with chunk headers and is called from a materialized view at insert time to count LLM tokens per span. Its token counts are joined against a daily-refreshed LiteLLM price dictionary for cost attribution, and a Python UDF calls Claude to grade a sample of completions. Practical lessons include RowBinary being ~20% faster than TabSeparatedRaw and binary-safe, sizing memory limits for virtual address space (Go reserves ~1.2 GiB), and throughput of ~13M tokens/sec on 4 vCPUs.

The quest for software engineering knowledge.

Look:
Layout: