AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
<!DOCTYPE html>
<html lang="en" data-theme="day">
<head>
<!-- ga4:begin — generated by scripts/seo/seo_head.py · do not hand-edit -->
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z77ETCDJYL"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-Z77ETCDJYL');
</script>
<!-- ga4:end -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cutting the index 28%: dissect first, write Rust second</title>
<meta name="description" content="Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@400;700;800;900&family=Inter:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
<script src="/theme.js"></script>
<link rel="stylesheet" href="/style.css?v=if9">
<link rel="stylesheet" href="/blog.css?v=4">
<!-- seo:begin — generated by scripts/seo/fix_heads.py · do not hand-edit -->
<link rel="canonical" href="https://xerj.org/blog/cutting-the-index-28-percent">
<meta property="og:site_name" content="XERJ.ai">
<meta property="og:type" content="article">
<meta property="og:title" content="Cutting the index 28%: dissect first, write Rust second">
<meta property="og:description" content="Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.">
<meta property="og:url" content="https://xerj.org/blog/cutting-the-index-28-percent">
<meta property="og:image" content="https://xerj.org/og/blog-cutting-the-index-28-percent.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Cover: “Cutting the index 28%” in display type beside the post’s square-matrix art, labelled with its figures. The art: a large ink block of squares wrapped in a yellow L-shaped band that marks the 28% cut, beside two pairs of thin before-and-after bars">
<meta property="og:locale" content="en_US">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Cutting the index 28%: dissect first, write Rust second">
<meta name="twitter:description" content="Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.">
<meta name="twitter:image" content="https://xerj.org/og/blog-cutting-the-index-28-percent.png">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"@id": "https://xerj.org/#organization",
"name": "XERJ",
"alternateName": "XERJ.ai",
"url": "https://xerj.org/",
"logo": "https://xerj.org/brandbook/xerj-mark.svg",
"description": "A new way for AI to search for data: one local Rust binary that indexes your code, docs, specs and logs, plus Corpus Hub packs, and returns cited answers.",
"sameAs": [
"https://github.com/xerj-org/xerj",
"https://x.com/xerj_org"
]
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"@id": "https://xerj.org/#website",
"name": "XERJ.ai",
"url": "https://xerj.org/",
"inLanguage": "en",
"publisher": {
"@id": "https://xerj.org/#organization"
}
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Cutting the index 28%: dissect first, write Rust second",
"description": "Four file-format changes took our 100k-doc index from 5.52 MB to 3.99 MB (−28%), each gated on dissecting real segments first. The losing rows are in the post.",
"url": "https://xerj.org/blog/cutting-the-index-28-percent",
"image": "https://xerj.org/og/blog-cutting-the-index-28-percent.png",
"inLanguage": "en",
"datePublished": "2026-09-27",
"dateModified": "2026-09-27",
"author": {
"@id": "https://xerj.org/#organization"
},
"publisher": {
"@id": "https://xerj.org/#organization"
},
"isPartOf": {
"@id": "https://xerj.org/#website"
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://xerj.org/blog/cutting-the-index-28-percent"
}
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://xerj.org/"
},
{
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "https://xerj.org/blog/"
},
{
"@type": "ListItem",
"position": 3,
"name": "Cutting the index 28%"
}
]
}
</script>
<!-- seo:end -->
</head>
<body>
<nav class="nav" aria-label="Primary">
<a href="/" class="brand">XERJ</a>
<a href="/product">PRODUCT</a>
<a href="/use-cases">USE CASES</a>
<a href="/answers/">ANSWERS</a>
<a href="/benchmarks/">BENCHMARKS</a>
<a href="/blog/" class="active">BLOG</a>
<span class="spacer"></span>
<a href="/for-agents">FOR AGENTS</a>
<a href="/docs/">DOCS</a>
<a href="/playground">DASHBOARDS</a>
<a href="https://hub.xerj.org" rel="external">HUB</a>
<a class="nav-stars" href="https://github.com/xerj-org/xerj" rel="external" title="XERJ on GitHub" aria-label="XERJ on GitHub, 14,225 stars"><svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg><span class="nav-stars-n" data-gh-stars="14225">★ 14.2k</span></a>
<a href="https://x.com/xerj_org" rel="external" title="XERJ on X" style="display:inline-flex;align-items:center"><svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg></a>
<a href="https://discord.com/invite/yetXFusXfs" rel="external" title="XERJ on Discord" style="display:inline-flex;align-items:center"><svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M20.317 4.37a19.79 19.79 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.74 19.74 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.1 13.1 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.3 12.3 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.84 19.84 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"/></svg></a>
<span class="theme">
<button type="button" data-theme="day" class="active">DAY</button>
<span class="dash">·</span>
<button type="button" data-theme="night">NIGHT</button>
</span>
</nav>
<main>
<div class="uc-hero">
<p class="blog-crumb"><a href="/blog/">← ALL POSTS · /BLOG</a></p>
<figure class="blog-cover"><img src="/blog/covers/cutting-the-index-28-percent-hero.webp" width="1600" height="640" alt="Cover art: a large ink block of squares wrapped in a yellow L-shaped band that marks the 28% cut, beside two pairs of thin before-and-after bars" fetchpriority="high" decoding="async"></figure>
<div class="uc-eyebrow">STORAGE · ON-DISK SIZE · 100K-DOC HARNESS · RUNS 2026-09-26/27</div>
<h1>A DISSECTION, FOUR FILE FORMATS,<br><span class="accent">AND 28% OFF THE INDEX</span></h1>
<p class="blog-byline">XERJ ENGINEERING · PUBLISHED 2026-09-27</p>
<p class="lede">We spent two days cutting the on-disk size of a XERJ index by 28 percent —
from about 5.52 MB to 3,989,254 bytes on a 100k-document benchmark — and the interesting part is not the
number. It is that three of the four format changes we shipped ended up shaped differently from
the plans that started them, because we dissected real segment files before writing any Rust,
and kept every losing row.</p>
</div>
<section class="scene-section">
<div class="kicker">01 · THE METHOD</div>
<h2 class="scene">Dissect first, write Rust second</h2>
<p>The size work started as an <a href="https://github.com/xerj-org/xerj/issues/1038" rel="external">epic</a>
with a waste list written against the code: numeric doc-values stored as raw 8-byte lanes, postings
block headers carrying bytes the reader could derive, per-term metadata in fixed 24-byte records,
the same keyword strings stored three times per segment. A confident list. Parts of it were wrong,
and the way we found out which parts is the method worth writing down.</p>
<p>Stage zero built a harness,
<a href="https://github.com/xerj-org/xerj/tree/main/benchmarks/index-size" rel="external"><code class="inline">benchmarks/index-size</code></a>:
100,000 documents — 4,008 real telemetry events cycled 25 times, each with a timestamp, a model
name, token counts, a cost, a tenant, and a body of text — bulk-indexed into a throwaway node,
force-merged to a single segment, then a byte census by file family and by field. Every format
change in this post landed with its A/B result committed beside it.</p>
<p>The rule the epic settled on: before writing a codec, copy the segment file out of the data
directory and dissect it offline — <code class="inline">python3</code> and the
<code class="inline">zstd</code> command line are enough — and predict the payoff from the actual
bytes. Only then open the editor. Four formats went through that gate:</p>
<div class="vt-wrap">
<table class="vt">
<thead><tr><th>Format change</th><th>Family</th><th>Before → after (B)</th><th>Δ</th></tr></thead>
<tbody>
<tr><td>ZNV2 · doc-values FOR + bitpack, per-column chooser</td><td class="t">.dv</td><td class="n">390,487 → 355,156</td><td class="n w">−9.0%</td></tr>
<tr><td>ZPS2 · postings frame-of-reference framing</td><td class="t">.post</td><td class="n">2,449,405 → 2,364,905</td><td class="n w">−3.4%</td></tr>
<tr><td>ZBS4 · typed-int stored columns, duplicate refs</td><td class="t">.seg</td><td class="n">1,671,271 → 449,094</td><td class="n w">−73.1%</td></tr>
<tr><td>ZFM5 · columnar varint term metadata</td><td class="t">.meta</td><td class="n">200,826 → 13,774</td><td class="n w">−93.1%</td></tr>
<tr><td><strong>whole index, last two stages (committed pair)</strong></td><td class="t">all</td><td class="n"><strong>5,398,478 → 3,989,254</strong></td><td class="n w"><strong>−26.1%</strong></td></tr>
</tbody>
</table>
</div>
<p>Each row is a same-day A/B against a control binary on the same corpus at the balanced
compression level, one force-merged segment; the first two stages' tables live in the changelog
entries and the last two stages' result files are committed beside the harness. Those last two
were also re-measured together on the merged tree — 4,176,306 to 3,989,254 B — and subtracting
the <code class="inline">.meta</code> delta from that control reproduces the endpoint to the
byte. Sum all four family deltas and the index that entered the epic at roughly 5.52 MB came
out at 3,989,254 B: −27.7%, which the headline rounds to 28. The two biggest wins are the
two formats the dissection redirected, and they are the middle of this post.</p>
</section>
<section class="scene-section">
<div class="kicker">02 · THE FIRST LESSON</div>
<h2 class="scene">The plan lost to plain bytes on our own corpus</h2>
<p>The first change looked like the safest bet on the list. Numeric doc-value columns were stored
as raw 8-byte values per document; the textbook fix is frame-of-reference plus bit-packing —
subtract the minimum, divide out the greatest common divisor, pack the residuals into
128-document blocks at the width the spread demands. That is the shape tantivy's columnar store
uses, and our unit tests measure monotone strided columns ~5× smaller than raw before
compression.</p>
<p>The first cut shipped bitpack-everywhere. The harness rejected it outright: the
<code class="inline">.dv</code> family came out at 2.0× the baseline — 789,167 B against
390,487. The optimization doubled the size of the thing it was optimizing.</p>
<p>The reason is the interesting part. The corpus cycles its 4,008 events, so the raw lanes
repeat byte-for-byte down the file, and the outer zstd pass matches repeating bytes almost for
free. Bit-packing is block-local: every 128-doc block scrambles the byte grid the compressor was
matching against. An information-theoretic win lost, on real bytes, to a compressor that could
see the whole file.</p>
<div class="loss">
<strong>Bitpack-always: 2.02× the .dv size.</strong> The row stays at the top of the
losing table because it is the whole argument for the method — the format we were most
confident about was the one our own corpus rejected hardest.
</div>
<p>What shipped instead races both candidates per column — the bit-packed layout and the raw one —
compresses both at the real level, and keeps whichever is smaller after zstd: the Parquet
pick-the-smallest rule. On this worst-case-for-bitpacking corpus it wins 9.0% on
<code class="inline">.dv</code> (0.6% of the whole index); on genuinely monotone columns —
timestamps, counters — it can win five times as much. The chooser pays both prices and never
guesses.</p>
</section>
<section class="scene-section">
<div class="kicker">03 · THE FRAMING TAX</div>
<h2 class="scene">Postings: a percent here, a percent there</h2>
<p>The postings files carry, for every term, the sorted document ids and the term frequencies,
packed in 128-document blocks. The blocks were paying a framing tax: a 4-byte length that is a
pure function of the bit width, and a residual count the reader can derive on its own. ZPS2
re-framed them — <code class="inline">[width][vbyte min]</code>, where width zero means a
constant block that carries no payload at all; the positions block lost its length prefix
(exactly 128 count-and-delta groups pin its end); and a positioned term whose total term
frequency equals its document frequency omits its <em>entire</em> frequency stream, because the
reader can re-derive every count as one.</p>
<p>Measured: <code class="inline">.post</code> −3.4% (2,449,405 → 2,364,905 B),
<code class="inline">body.post</code> −4.3% (1,828,102 → 1,749,695 B). Small and
honest — and the widest keyword family in the corpus (<code class="inline">top_doc</code>,
12 terms at df ≈ 8.3k) went the other way, +1.5%. Families move in both directions; the
family total is what gates the merge.</p>
</section>
<section class="scene-section">
<div class="kicker">04 · THE WHALE</div>
<h2 class="scene">The stored section, where the dissection redirected the plan</h2>
<p>The <code class="inline">.seg</code> file holds the stored documents — the columnar copy of
<code class="inline">_source</code>. The epic's plan for it was dictionary work on keyword
columns. Then we dissected one: the planned dict-stream work targeted about 5% of the section.
The body text's JSON fallback alone was 84.2% of it. The plan was aiming at the wrong end of
the file.</p>
<p>The same dissection showed two cheaper embarrassments:
<code class="inline">__seq_no</code> — consecutive integers — stored as ASCII text, five bytes
for “12345”; and <code class="inline">doc_id</code> stored as a byte-identical
duplicate of the engine's internal <code class="inline">__id</code> column. Three codecs went
in instead of the dictionary work:</p>
<ul>
<li><strong>TYPED_INT</strong> — an all-integer column becomes a presence bitmap plus
128-value frame-of-reference blocks, the same shape as the ZPS2 postings framing, with a
zigzag-varint residual for what escapes the blocks. Floats and strings never qualify and keep
the JSON fallback.</li>
<li><strong>COPY_OF</strong> — a column byte-identical to an earlier column is written as a
4-byte reference, after a digest plus a full equality check. An id echoed into
<code class="inline">_source</code> costs 4 bytes instead of a second payload.</li>
<li><strong>A long-effort chooser, merge path only</strong> — each JSON-fallback column is
additionally compressed at zstd level 19 with long-distance matching and an explicit 16 MB
window; the smaller payload wins. Flush stays pinned to level 3, where an earlier measurement
showed level 19 is an ingest regression we had no reason to re-learn.</li>
</ul>
<p>Two measured reasons the third codec is a chooser and not a level bump. The window knee is
sharp: the 29.8 MB body column compresses to 679 kB at the default window and 330 kB at 16 MB,
because the corpus's sentence pool repeats just past a small window. And high levels
<em>regress</em> small-alphabet streams: the id column is 54 kB at level 3 and 143 kB at
level 19. A global 19 would grow the ids while it shrank the body.</p>
<p>Result: <code class="inline">.seg</code> −73.1% (1,671,271 → 449,094 B), the
whole index −22.6% in one stage (5,398,478 → 4,176,300 B). Every other file family
is byte-identical between those two runs but for one byte in a manifest counter — the change is
fenced to its own envelope, and anything an older codec could already express is still written
in that older codec, byte for byte.</p>
</section>
<section class="scene-section">
<div class="kicker">05 · THE EMBARRASSING ONE</div>
<h2 class="scene">138.7 KB for about 200 bytes of information</h2>
<p>The <code class="inline">.meta</code> files hold per-term postings metadata: document
frequency, total term frequency, and a pointer into the postings — for every term in the field's
dictionary. <code class="inline">doc_id</code> has 100,000 unique terms, and in this corpus
every one of them has <code class="inline">ttf == df</code> (each document holds its id once)
and every postings gap is zero. The information content of that file is a few hundred bytes.
It cost 138,727 B.</p>
<p>The culprit was the record stride: <code class="inline">{df u32, ttf u64, offset u64,
len u32}</code> — 24 fixed bytes per term, interleaved. zstd did compress that stream,
seventeen-fold, but it cannot match across the stride's alternating field widths, so every
record still cost it residual bytes on the lanes that vary: about 1.4 bytes per term, 138.7 kB
across a hundred thousand terms, for a file whose information content is a few hundred
bytes.</p>
<p>The obvious first move — keep the records, delta-encode the fields in place under the
envelope — would have kept the stride, and the stride itself was the cost. ZFM5 reshapes the
section <em>before</em> compressing it: four
columnar varint streams — df, ttf − df (elided entirely when every term in
the field has <code class="inline">ttf == df</code>, which is the keyword-field shape), offset
gaps, and lengths. zstd sees four long runs of one-symbol lanes instead of 100,000 interleaved
records. On the final tree that file is 216 B on disk, envelope header included. The reader expands the streams once at
open time into the flat record array the previous formats built, so the term-lookup hot path
is untouched.</p>
<p>One more thing this format earned before it merged. An adversarial review of the diff —
independent reviewers told to break the decoder — confirmed exactly one real defect: the
total-frequency reconstruction was the only unchecked addition left in the expansion loop, and a
crafted delta could wrap it in a release build to <code class="inline">ttf < df</code>,
silently flipping the freq-elision predicate from section 03. Unreachable from our writer,
but a decoder should not trust its writer. Fixed with checked arithmetic and a regression test
that feeds it the crafted delta. <code class="inline">.meta</code> finished at
−93.1% (200,826 → 13,774 B).</p>
<p>The peer anchor is worth naming: tantivy's term dictionary serializes block-leading absolute
ranges once and per-term VInt lengths, reconstructing offsets by accumulation — same insight,
MIT-licensed, cited beside our implementation of it. The columnar split and the elision flag
are ours.</p>
</section>
<section class="scene-section">
<div class="kicker">06 · THE BASELINES</div>
<h2 class="scene">Six percent of raw — and the caveat that number needs</h2>
<p>After the four stages, the index for those 100,000 documents — the whole data directory — is
3,989,254 B. The raw documents are 63,461,256 B of NDJSON, measured off the exact bulk payload
the harness indexed. Against the obvious baselines on the same bytes:</p>
<div class="vt-wrap">
<table class="vt">
<thead><tr><th>100,000 documents, same bytes</th><th>Size (B)</th><th>% of raw</th></tr></thead>
<tbody>
<tr><td>raw NDJSON documents</td><td class="n">63,461,256</td><td class="t">—</td></tr>
<tr><td><code class="inline">zstd -19</code> of the raw</td><td class="n">1,571,615</td><td class="n">2.5%</td></tr>
<tr><td><code class="inline">gzip -9</code> of the raw</td><td class="n">4,089,793</td><td class="n">6.4%</td></tr>
<tr><td><strong>XERJ index, whole data dir</strong></td><td class="n w">3,989,254</td><td class="n w">6.3%</td></tr>
<tr><td><code class="inline">zstd -3</code> of the raw (our flush level)</td><td class="n">5,866,915</td><td class="n">9.2%</td></tr>
</tbody>
</table>
</div>
<p>The index — which answers queries, accepts updates and deletes, and gives random access into
every one of those bytes — lands smaller than <code class="inline">gzip -9</code> of the same
text. It will never reach <code class="inline">zstd -19</code> of a sequential stream, and it should not be asked to:
that row is a compressor with unbounded CPU and no obligation to ever seek.</p>
<div class="loss">
<strong>The caveat, plainly.</strong> This corpus is deliberately repetitive — 4,008 events
cycled 25 times over a twelve-sentence body pool. It is a stress harness for format work, not
a product ratio. On your corpus the index will be a larger fraction of raw. The deltas in the
first table are what transfer; the 6.3% is not. We print it only to anchor the baseline row.
</div>
</section>
<section class="scene-section">
<div class="kicker">07 · WHAT'S LEFT</div>
<h2 class="scene">Two whales, and a plan for each</h2>
<p>Where the 3,989,254 B went, from the committed harness result for the final tree (the
<code class="inline">.seg</code> family measured 449,094 B in that stage's own A/B — two
bytes of run-to-run noise):</p>
<div class="vt-wrap">
<table class="vt">
<thead><tr><th>File family</th><th>Bytes</th><th>Share</th><th>What it is</th></tr></thead>
<tbody>
<tr><td>.post</td><td class="n">2,364,905</td><td class="n">59.3%</td><td class="t">postings — body.post alone is 1,749,695 B</td></tr>
<tr><td>.ids</td><td class="n">613,485</td><td class="n">15.4%</td><td class="t">seq_no → external id map for fast restart</td></tr>
<tr><td>.seg</td><td class="n">449,092</td><td class="n">11.3%</td><td class="t">stored columns (_source)</td></tr>
<tr><td>.dv</td><td class="n">355,156</td><td class="n">8.9%</td><td class="t">doc values for sorting and aggs</td></tr>
<tr><td>.fst</td><td class="n">105,760</td><td class="n">2.7%</td><td class="t">term dictionaries</td></tr>
<tr><td>.json + .norms + .meta</td><td class="n">96,809</td><td class="n">2.4%</td><td class="t">manifests, BM25 lengths, term metadata</td></tr>
<tr><td>everything else</td><td class="n">4,047</td><td class="n">0.1%</td><td class="t">markers, keys, locks</td></tr>
</tbody>
</table>
</div>
<p>Two clusters dominate. <strong>Body text is ~2.11 MB, about 53% of the index</strong> —
postings for the body field (1,749,695 B), its stored column (328,266 B), its length norms
(35,194 B). That is 7.1% of the 29.8 MB of raw body text: text is already near its entropy, and
the remaining wins there are incremental framing work. <strong>The id echo is ~0.88 MB, about
22%</strong> — in this corpus <code class="inline">_id</code> and
<code class="inline">doc_id</code> are the same string, and it is stored four ways: the
<code class="inline">.ids</code> pairs at 613 kB, <code class="inline">doc_id</code>'s own
postings at 256 kB, the <code class="inline">__id</code> stored column — 9.4 kB on the merged
tree, after stage 1's duplicate-reference and long-effort codecs had their way with it — and
term-dictionary slices. That cluster still pays ~45% of its raw bytes, where the body pays
7.1%.</p>
<p>Stage 2 is dictionary reuse: the full-text term dictionary already <em>is</em> a finished
dictionary for keyword fields — today we learn the ids and then store them again in two more
places; referencing term ordinals from the other columns deletes the echo. Stage 3 is trained
zstd dictionaries for the many-small-files tail. Neither is measured yet, so neither gets a
number in this post; when they are, the losing rows will be in that one too.</p>
</section>
<section class="scene-section">
<div class="kicker">08 · THE LOSING ROWS</div>
<h2 class="scene">What we tried and kept out</h2>
<div class="vt-wrap">
<table class="vt">
<thead><tr><th>Variant</th><th>Measured</th><th>Verdict</th></tr></thead>
<tbody>
<tr><td>bitpack-always .dv</td><td class="n l">2.02× baseline</td><td class="t">per-column chooser ships instead</td></tr>
<tr><td>zstd-19, default window, body column</td><td class="n l">679 kB</td><td class="t">330 kB at an explicit 16 MB window — the window is the knob</td></tr>
<tr><td>zstd-19 on the id column</td><td class="n l">54 kB → 143 kB</td><td class="t">regression; effort is chosen per column</td></tr>
<tr><td>ZPS2 on the widest keyword family</td><td class="n l">+1.5%</td><td class="t">kept — the family total still wins</td></tr>
<tr><td>.meta with the 24-byte stride kept</td><td class="n l">138,727 B for doc_id.meta</td><td class="t">the stride itself was the cost; ZFM5 removes it</td></tr>
</tbody>
</table>
</div>
<p>Every number in this post traces to a run. The harness and its design notes are committed in
<a href="https://github.com/xerj-org/xerj/tree/main/benchmarks/index-size" rel="external">benchmarks/index-size</a>,
with the last two stages' result files beside them and the first two stages' A/B tables in the
changelog entries; the work is tracked in
<a href="https://github.com/xerj-org/xerj/issues/1038" rel="external">epic
#1038</a> and landed as pull requests
<a href="https://github.com/xerj-org/xerj/pull/1040" rel="external">#1040</a>,
<a href="https://github.com/xerj-org/xerj/pull/1041" rel="external">#1041</a>,
<a href="https://github.com/xerj-org/xerj/pull/1042" rel="external">#1042</a> and
<a href="https://github.com/xerj-org/xerj/pull/1043" rel="external">#1043</a>, each with its own
measured table. The wire-compatibility conformance suite stayed green across all four merges —
the gate that outranks size.</p>
<p>If you would rather check the claim than read about it: the engine is
<a href="/docs/install">one binary</a>, the harness is in the repository, and your own corpus is
the benchmark that matters. The retrieval side of this engine's story is in
<a href="/blog/does-xerj-beat-jev">our post on reranking</a> and
<a href="/blog/jev-vs-a-bm25-vote">the BM25-vote decisions study</a>; the wire-protocol
conformance numbers live on the <a href="/benchmarks/">benchmarks page</a>.</p>
</section>
</main>
<!-- seo:footer-begin — generated by scripts/seo/fix_links.py · do not hand-edit -->
<nav class="footer-map" aria-label="Site map">
<div class="fm-col">
<span class="fm-h">PRODUCT</span>
<a href="/product">PRODUCT</a>
<a href="/architecture/">ARCHITECTURE</a>
<a href="/benchmarks/">BENCHMARKS</a>
<a href="/pricing/">PRICING</a>
<a href="/security/">SECURITY</a>
<a href="/playground">DASHBOARDS</a>
<a href="/demo/">REAL-DATA DEMO</a>
<a href="/aise-demo">PRODUCT TOUR</a>
</div>
<div class="fm-col">
<span class="fm-h">LEARN</span>
<a href="/answers/">ANSWERS</a>
<a href="/compare/">COMPARE</a>
<a href="/use-cases">USE CASES</a>
<a href="/case-studies">CASE STUDIES</a>
<a href="/industries/">INDUSTRIES</a>
<a href="/blog/">BLOG</a>
</div>
<div class="fm-col">
<span class="fm-h">SOLUTIONS</span>
<a href="/solutions/">SOLUTIONS</a>
<a href="/industries/finserv">FINANCIAL SERVICES</a>
<a href="/industries/public-sector">PUBLIC SECTOR</a>
<a href="/industries/healthcare">HEALTHCARE</a>
<a href="/industries/retail">RETAIL</a>
<a href="/use-cases/code-security-audit">AI CODE-SECURITY AUDIT</a>
<a href="/use-cases/semantic-analytics">SEMANTIC ANALYTICS</a>
<a href="/resources/">SALES KIT</a>
</div>
<div class="fm-col">
<span class="fm-h">DOCS</span>
<a href="/docs/">DOCUMENTATION</a>
<a href="/docs/quickstart">QUICKSTART</a>
<a href="/docs/install">INSTALL</a>
<a href="/docs/migration-from-es">MIGRATE FROM ELASTICSEARCH</a>
<a href="/docs/recipes/">RECIPES</a>
<a href="/docs/agents/">DOCS FOR AI</a>
<a href="/for-agents">FOR AI AGENTS</a>
<a href="/agent-search/">AGENTIC SEARCH DEMO</a>
<a href="/llms.txt">LLMS.TXT</a>
<a href="https://github.com/xerj-org/xerj" rel="external">GITHUB</a>
</div>
</nav>
<!-- seo:footer-end -->
<footer class="footer">
<span>XERJ.AI · V1.0.0-RC.100 · 2026</span>
<span>SEARCH FOR THE AGENT ERA</span>
<span><a href="/product">PRODUCT</a> · <a href="/docs/">DOCS</a> · <a href="/answers/">ANSWERS</a> · <a href="/playground">DASHBOARDS</a> · <a href="/llms.txt">LLMS.TXT</a></span>
</footer>
<script src="/interact.js" defer></script>
</body>
</html>