Repository navigation
Description
Summary
SELECT ts, uu FROM Point WHERE host = 'host_50' ORDER BY ts DESC LIMIT 1 against a native TIMESERIES type is 3-5x slower than the identical query, over the identical points, against an ordinary DOCUMENT type with a (host, ts) index in the same database. Both arms return the same row.
This is the residual after the three fixes that already landed on this query, and it is not a report that any of them regressed. #5414 gave the sealed layer a newest-first block scan, #5416 made the unsealed tail read newest-first, and #7322 pointed the REST/gRPC latest path at queryDescending. They worked: on 2,592,000 points the query that cost 208 ms before #5414 costs about 2 ms now, which is faster than the bounded 2.45 ms that #5414 quoted as its reference. The SQL path here is the one #7322 notes was already using queryDescending via FetchFromTimeSeriesStep.
The question is what is left: why the purpose-built type is still several times slower than a generic indexed one at the query that type exists for.
Measured
My TSBS cpu-only benchmark, one dedicated machine, one cell at a time, cpuset 0-11, 16 GiB cap, 8 GiB heap, five repetitions, median. Engine 26.10.1-dev (417314c18), embedded. Every engine below returns the byte-identical answer, checked by digest.
| arm | 2,592,000 points | 25,920,000 points |
|---|---|---|
ArcadeDB, native TIMESERIES |
2.112 ms | 3.183 ms |
ArcadeDB, DOCUMENT + (host, ts) index |
0.373 ms | 0.836 ms |
| QuestDB | 0.554 ms | 1.232 ms |
| TimescaleDB | 0.092 ms | 0.055 ms |
| DuckDB | 1.240 ms | 2.300 ms |
| MongoDB | 0.566 ms | 0.638 ms |
It scales sub-linearly - ten times the data costs about 1.5x the time - so this is not a series scan. It looks like a fixed per-query cost.
The control, and what it is not
The comparison that matters is ArcadeDB against ArcadeDB: same database, same SQL text, same answer, only the storage path differs. That rules out my client, my schema, the corpus and the machine in one step.
It is emphatically not "the TIMESERIES type is slow". On the same corpus the native type ingests in 2.1 s where the document path takes 57 s, and answers a 12-hour aggregate in 3.4 ms where the document path takes 1463 ms. The type is 27x better at ingest and 430x better at aggregation. This is one query, and it happens to be the one an operational dashboard polls most.
Reproduction
TsLastPointVsDocument.java, attached below: one file, no dependencies beyond the engine jars, no Maven.
docker run --rm -v "$PWD":/repro -w /repro arcadedata/arcadedb:<tag> \
java -Xmx6g -cp "/home/arcadedb/lib/*" TsLastPointVsDocument.java
| build | TIMESERIES |
DOCUMENT + index |
ratio |
|---|---|---|---|
| 26.8.1 (published release) | 2.658 ms | 0.630 ms | 4.2x |
| 26.10.1-SNAPSHOT | 1.986 ms | 0.650 ms | 3.05x |
Two notes for anyone re-running it, both of which cost me a run:
Create the document index before the inserts. Built afterwards instead, the same query on the same rows answers in 2.221 ms rather than 0.650 ms, and the document arm stops being a fair reference.
Put the database on a real filesystem. On a tmpfs /tmp the ingest and any flush are memory operations.
A possible direction, with what I did not check
TimeSeriesEngine.queryDescending walks every shard in sequence and merges, raising a lowerBound as it goes. For a tag-filtered last point each shard still has to find its own newest row for that tag, and page pruning is by the DATA_MIN_TS / DATA_MAX_TS headers - by time, not by tag - so every shard pays at least one block decompression before the tag filter can reject anything. The document index answers the same question with a single seek.
This is the second half of what #5414 originally proposed and did not get: that issue asked for "a per-shard/per-tag latest-timestamp shortcut ... O(shards) instead of O(series)" and was fixed with the descending scan, which solved the O(series) part. A per-(shard, tag) max-ts map, maintained on append and consulted before any page is touched, would turn this into a lookup plus one row fetch. Whether that is worth the memory per tag is your call - with high-cardinality tags it is not free, and a per-shard map alone would already cut the work.
I have not profiled where the 2 ms actually goes, so treat the mechanism above as the reading of the code that motivated the measurement, not as a diagnosis. If the answer is "this is the floor for a merged multi-shard read and a single-seek index will always win", that is a perfectly good answer and worth having in the open.
Activity
tae898 commentedon Sep 22, 2026
The repro, for completeness. Save as
TsLastPointVsDocument.javaand run it with the command in the issue body.fix(#8179): charge a boxed dictionary STRING column what it actually …
fix(#8179): charge a cached tag column for the strings it keeps alive
fix(#8179): test the budget branches that only fire under pressure
fix(#8179): say that the two shapes of one dictionary column share no…
fix(#8179): state exactly which of downsampling's columns go through …
fix(#8179): a boxed BYTE column holds constants too, and say where th…
Merge pull request #8194 from ArcadeData/fix/issue-8179
lvca commentedon Sep 22, 2026
Fixed in #8194, released in 26.10.1.
What was actually slow. Not the tag filtering: a TimeSeries type already skips compacted blocks that don't contain the tag you asked for, and in your benchmark 3 of the 4 shards were correctly skipping everything without reading a byte. The cost was on the one shard that did hold
host_50. A compacted block holds up to 65,536 samples stored one compressed column at a time, and there was no cache of decoded blocks - so returning a single row meant decoding 65,536 timestamps, 65,536 host values and 65,536 measurements, and the next poll decoded all of them again. That is also why you measured a flat cost that barely grew with the dataset: it was always "decode one block", never "scan the series".The fix. Compacted blocks never change once written, so a decoded block can be kept and reused. Reading the same block again now costs nothing extra. On a repeated last-point query the measured time went from 0.089 ms to 0.004 ms in our test - comfortably below the indexed
DOCUMENTarm.On your suggested per-(shard, tag) max-timestamp map: it wouldn't have closed the gap. Knowing which block holds the newest row for a tag still leaves you decoding that block to read the row out of it, which is where the time was going.
Tuning. The new
arcadedb.timeSeriesDecodedBlockCacheRAMsetting controls the memory budget, in MB and per shard. It sizes itself from the JVM heap by default, so you don't need to set anything; set it to 0 to switch caching off. Note a shard picks up a change when it is opened, so reopen the database to apply it everywhere.Thanks for the unusually careful report - the ArcadeDB-vs-ArcadeDB control, the note about creating the document index before the inserts, and the guard against timing a query that matched no rows all made this much faster to pin down.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
tae898 commentedon Sep 22, 2026
Verified on my side, and the gap does not just close — it reverses.
Same repro, same machine, same 2,592,000-point TSBS shape,
cpuset0-11, 8 GiB cap, 6 GiB heap, p50 of 100 iterations after 20 warmup. Only the engine differs: the "before" is the26.10.1-SNAPSHOTimage as it stood earlier today, the "after" is the same tag rebuilt with #8194.(host, ts)index4.75x on the TIMESERIES path, and the document arm is unchanged at 0.650 → 0.680 ms, which is the control: the fix moved the thing it was supposed to move and nothing else.
Your reading of where the time went also explains something my own measurement had shown and I had not accounted for. I reported the query scaling sub-linearly — 2.112 ms at 2.59M points against 3.183 ms at 25.92M, 10x the data for 1.5x the time — and read that as "fixed per-query overhead, not a scan". "Always decode one block, never scan the series" is the same observation with the mechanism attached.
Thank you for the note on the per-(shard, tag) max-timestamp map not being the answer. That was the part of my suggestion I was least sure of, and it is useful to know that knowing which block still leaves you decoding it — that is the half I could not see from outside.
I will pick this up on the benchmark page at my next engine re-pin rather than immediately: the campaign currently running holds one engine from first cell to last, so a mid-run swap would split its rows. The numbers above are from the verification host, which is why they are here and not on the page yet.
fix(ArcadeData#8179): a sealed TimeSeries block read twice decodes once