EmbeddedRocksDB with a two-column key: a PR that waited four years
EmbeddedRocksDB accepted exactly one primary key column, which broke the neat last-value-per-key pattern. A PR appeared five weeks after my request and merged in January 2026, in 26.1.
Source: github.com
EmbeddedRocksDB overwrites a row when you insert an existing key, which makes “last value per key” a one-line point read, fed by a materialized view. In 2021 the engine accepted only one primary key column, so a real key like (sensor_id, metric) failed with BAD_ARGUMENTS. A user offered a workaround, a single Tuple column built by DEFAULT, which I called clever but still a workaround; a later commenter noted dictionaries refuse a Tuple attribute, so it cannot back a complex-key dictionary.
The issue carried the easy task label. PR #33917 by usurai was opened on 2022-01-22, five weeks after my request, and merged on 2026-01-09. The 26.1 changelog lists it: “Support multiple columns as primary key in EmbeddedRocksDB.” Key columns are serialised in creation order into the RocksDB key.
On 26.4 this works:
CREATE TABLE last_point (sensor_id UInt32, metric String, ts DateTime, value Float64)
ENGINE = EmbeddedRocksDB PRIMARY KEY (sensor_id, metric);
Two cautions: “last” means last written, not latest ts, so late data overwrites newer data; and per the PR design, a WHERE that does not fix every key column scans the whole table.
Discussion
Comments live in GitHub Discussions. Sign in with GitHub to join in.