Showcases¶
pqbench earns its keep on real files, not on a two-column smoke sample. Each showcase below is a job you might actually run — find the columns that own the bytes, choose a codec, verify a layout change, read a file from the wild — with the numbers the tool printed.
The first four run on the committed Reddit comments sample
(crates/pqbench-cli/tests/fixtures/small_reddit_none.parquet, 3000 rows, 7
columns). The next two use larger public datasets committed under
data/samples/ (Git LFS). All six of those blocks run in the gate; after a
clone that skipped LFS, fetch and verify the samples first:
Where the bytes go¶
A 2.1 MB Reddit sample. Before tuning anything, find the columns that own the
bytes — bytemass reads only the footer, so it answers in milliseconds:
$ pqb table-file crates/pqbench-cli/tests/fixtures/small_reddit_none.parquet | pqb bytemass | pqb fmt
column type codec encoding bytes dict bytes bytes/row values
---------------- ---------- ------------ -------- ------ ---------- --------- ------
text BYTE_ARRAY UNCOMPRESSED dict 743566 738658 247.86 3000
label BYTE_ARRAY UNCOMPRESSED dict 2469 527 0.82 3000
dataType BYTE_ARRAY UNCOMPRESSED dict 360 33 0.12 3000
communityName BYTE_ARRAY UNCOMPRESSED dict 2468 527 0.82 3000
datetime BYTE_ARRAY UNCOMPRESSED dict 87 28 0.03 3000
username_encoded BYTE_ARRAY UNCOMPRESSED dict 446197 441331 148.73 3000
url_encoded BYTE_ARRAY UNCOMPRESSED dict 907117 901963 302.37 3000
Three columns — url_encoded (907 KB), text (744 KB), username_encoded
(446 KB) — are 99.7% of the 2.10 MB file. The other four together are about
5 KB. That is the whole triage: four columns are noise, three are the file.
url_encoded and username_encoded are hashed ids stored as text, so they
compress poorly and cost the most per row. Optimize the three big columns;
leave the rest alone.
The same stream draws a treemap, with no server and no build step:
$ pqb table-file crates/pqbench-cli/tests/fixtures/small_reddit_none.parquet | pqb bytemass | pqb format --html > /tmp/reddit.html
Which codec¶
The sample is stored uncompressed, so the codec is the first lever. Sweep the codecs over the file's encoded pages:
$ pqb compression crates/pqbench-cli/tests/fixtures/small_reddit_none.parquet --samples 1 --warmup-iterations 0 | pqb fmt
codec level compress MB/s decompress MB/s ratio
------ ----- ------------- --------------- -----
zstd 1 ±458 ±1722 0.56
gzip 1 ±68 ±270 0.58
lz4 1 ±897 ±8476 0.81
snappy 1 ±912 ±2101 0.81
Speeds vary run to run; the ratios do not. zstd takes the file to 0.56 of its bytes (44% smaller); snappy and lz4 reach only 0.81 (19% smaller) but compress about twice as fast. gzip buys nothing over zstd and writes several times slower. Unless write or decode speed is the binding constraint, zstd is the answer here.
Files from the wild¶
The committed samples in data/samples/ are real Parquet from public datasets:
SQuAD (nested lists) and the TPC-DS customer table (DELTA_BYTE_ARRAY
encoding). bytemass folds each column's row groups into one record, so the
stream is already a per-column total:
$ pqb table-file data/samples/squad.parquet \
> | pqb bytemass \
> | jq -r 'select(.mass) | [(.name | capture("/columns/(?<c>[^/]+)$").c), .mass.compressed_bytes] | @tsv' \
> | sort -k2 -nr
context 8490172
question 3027096
answers.text.list.item 1515148
id 709562
answers.answer_start.list.item 304136
title 18488
context alone is 8.5 MB of the 14.5 MB file (59%); context and question
together are 80%. A nested list column shows up as a dotted physical path
(answers.text.list.item), so a shell can roll such prefixes up when
comparing two layouts.
A real table with a non-default encoding reads the same way:
$ pqb table-file data/samples/delta_byte_array.parquet | pqb bytemass | pqb fmt
column type codec encoding bytes dict bytes bytes/row values
--------------------- ---------- ------------ ---------------- ----- ---------- --------- ------
c_customer_id BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 8248 0 8.25 1000
c_salutation BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 3362 0 3.36 1000
c_first_name BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 6595 0 6.59 1000
c_last_name BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 6955 0 6.96 1000
c_preferred_cust_flag BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 1220 0 1.22 1000
c_birth_country BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 9599 0 9.60 1000
c_login BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 42 0 0.04 1000
c_email_address BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 27763 0 27.76 1000
c_last_review_date BYTE_ARRAY UNCOMPRESSED DELTA_BYTE_ARRAY 3511 0 3.51 1000
The footer reports the encoding the writer actually used, and
c_email_address (27 KB) dominates a table whose every other column is under
10 KB — the same triage, on a file from a different ecosystem.
OpenRTB bid streams¶
Real-time bidding is nested by construction. An IAB OpenRTB
2.5 bid request
carries imp[], site.publisher, seatbid[].bid[], and banner.format[];
rtblint (Apache-2.0) validates requests
against versioned snapshots of that spec. A bid-stream table therefore has
scalar leaves (id, user.ext, ext) beside repeated ones
(imp.list.element.ext, seatbid.list.element.bid.list.element.ext), and
bytemass names them by their physical path:
$ pqb table-file openrtb_bids_snappy.parquet | pqb bytemass \
> | jq -r '[(.name | capture("/columns/(?<c>[^/]+)$").c), .mass.codec, .mass.compressed_bytes] | @tsv' \
> | column -t -s $'\t'
id SNAPPY 222317
user.ext SNAPPY 1233750
ext SNAPPY 857121
imp.list.element.id SNAPPY 378
imp.list.element.bidfloor SNAPPY 83111
imp.list.element.ext SNAPPY 1507120
seatbid.list.element.bid.list.element.price SNAPPY 45471
seatbid.list.element.bid.list.element.adm SNAPPY 56398
seatbid.list.element.bid.list.element.w SNAPPY 264
seatbid.list.element.bid.list.element.h SNAPPY 264
seatbid.list.element.bid.list.element.ext SNAPPY 596900
The repeated leaves own the bytes — imp.list.element.ext (1.5 MB) and
seatbid...ext (597 KB) are 46% of this 4.6 MB, 6,000-request stream. lint is
one command; each suggestion is a rewrite measured against a control written by
the same writer at the same codec:
$ pqb lint openrtb_bids_snappy.parquet \
> | jq -r '[.column, .rule, (.savings_bytes|tostring)] | @tsv' \
> | column -t -s $'\t'
imp.list.element.ext codec 367098
user.ext base64-text 308676
ext codec 267701
seatbid.list.element.bid.list.element.ext codec 155642
id uuid-text 127012
imp.list.element.bidfloor codec 9988
A snappy bid stream yields 1.2 MB of measured savings in one pass. The scanner
prices the repeated leaves from their page headers and raw pages — codec
needs no decoded values — while the value rules read only scalar leaves:
user.ext is Base64 of a binary payload (four characters per three bytes) and
id is UUID text. Rewrite the file with zstd and the same commands find
the next layer, including stats-truncated on the nested leaves:
$ pqb lint openrtb_bids_zstd.parquet \
> | jq -r '[.column, .rule, (.savings_bytes|tostring)] | @tsv' \
> | column -t -s $'\t'
imp.list.element.ext stats-truncated 336
user.ext base64-text 5668
ext dictionary-unique 8199
seatbid.list.element.bid.list.element.ext stats-truncated 192
id uuid-text 29194
The footer win is small by nature — a chunk's bounds are a few hundred bytes —
but it is the same repeated leaves that used to be skipped, and uuid-text now
shows the smaller saving a stronger codec leaves it. Both runs read only the
footer and the sample row group, so they answer in seconds on a stream this
size.
Where to go next¶
- Every command — the CLI reference documents every command, its flags, and its output.
- The same pipe over Delta, Iceberg, and a catalog — Visual demos.
- Recipes from the facts —
pqb skill parquet-advisor(Agent skills) turns abytemassorlintresult into a write-path or DDL change.