Skip to content
This repository was archived by the owner on Nov 21, 2026. It is now read-only.

bindings: UNIQUE_HASH for equality-only ids (#9169), COMPACTION_INTERVAL for hourly time series (#9166), across docs, source, tests, examples - #178

Merged
tae898 merged 3 commits into
mainfrom
bindings-best-practices-oct5
Oct 5, 2026
Merged

tae898 merged 3 commits into
mainfrom
bindings-best-practices-oct5

Conversation

@tae898

@tae898 tae898 commented Oct 5, 2026

Copy link
Copy Markdown

Closes #177.

bindings: apply the maintainers' index and time-series best practices (UNIQUE_HASH for ids, COMPACTION_INTERVAL for hourly aggregates)

Two answers from the ArcadeDB maintainers are now confirmed and the bindings follow them: an id that is only read, updated and deleted by equality gets a UNIQUE_HASH index (ArcadeData#9169, fixed in ArcadeData#9222, 26.10.1), and a time-series type whose main query is an hourly aggregate declares COMPACTION_INTERVAL 1 HOURS with SHARDS left at its default (ArcadeData#9166).

The queries guide gains an "Index choice for an id" paragraph with the maintainers' numbers (hash inserts as fast as LSM or faster, point lookups about 3x faster, 200,000 entries), the rule for when to keep UNIQUE (ranges and ORDER BY) and when to keep an LSM index on a low-cardinality non-unique column (ArcadeData#9228), and what we measured on 26.9.1: the old sorted hash layout made a 200,000-id load 2.5 to 6 times slower than UNIQUE, so on 26.9.1 an id you bulk load stays UNIQUE. The schema API page and the create_index docstrings show the hash form for an id and the LSM form for a key you also order by.

Docs snippets that index an id or an email read only by equality now say UNIQUE_HASH: the async executor, database, exceptions, server, transactions, vector, schema and import pages, the quickstart, the troubleshooting guide, the core database and transactions guides, and the Java coverage page. Examples 21 and 26 and the Link.movieId index of example 04 switch the same way. Movie.movieId in example 04 stays UNIQUE because its test queries ORDER BY movieId, and the page says so. Example 17 declares COMPACTION_INTERVAL 1 HOURS in both of its CREATE TIMESERIES TYPE statements because every query it runs is an hourly bucket; the async executor page, the server guide and the example pages carry the pointer sentence.

A new test, test_unique_hash_index_serves_id_lookup_update_and_delete, covers the recommended path end to end: a UNIQUE_HASH index on an id, a point lookup by SQL and by openCypher, an update and a delete by id, EXPLAIN showing FETCH FROM INDEX, and a rejected duplicate. It passes on the 26.9.1 wheel and on a 26.10.1 snapshot (only the insert speed differs), so it carries no version guard. The testing pages follow it.

Left alone on purpose: every existing test that creates a UNIQUE index (they test the LSM unique constraint, restore, parallel insert and schema API paths), the partitioned parallel-insert paragraph that needs a UNIQUE index, non-unique name and category indexes, the benchmark harness (a separate decision), and example 22 with its explicit SHARDS 4. Two practices wait for ArcadeData#9250 to merge: the page-cache share guidance (ArcadeData#9168) and arcadedb.indexDefaultPageSize (ArcadeData#9175).

Verification: examples 04 (movielens-small), 17, 21 and 26 were run against a 26.10.1 snapshot before and after the change and print the same output apart from timings, the random index names, and UNIQUE_HASH where an index kind is printed. The affected test files and the full suite were run on the same snapshot. pre-commit and bandit (src and tests at low/low, examples at medium/high) are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi

tae898 and others added 3 commits October 5, 2026 10:54
… (UNIQUE_HASH for ids, COMPACTION_INTERVAL for hourly aggregates)

An id that is only read, updated and deleted by equality gets UNIQUE_HASH
(ArcadeData#9169, fixed in ArcadeData#9222, 26.10.1): docs snippets, examples 04
(Link.movieId), 21 and 26, and the create_index docstrings. UNIQUE stays where the
key is also ordered (Movie.movieId in example 04). The queries guide gains an
"Index choice for an id" paragraph with the maintainers' numbers and what we measured
on 26.9.1 (old sorted hash layout, 2.5 to 6 times slower loads), and the schema API
page follows it.

Example 17 declares COMPACTION_INTERVAL 1 HOURS in both CREATE TIMESERIES TYPE
statements, since every query it runs is an hourly bucket (ArcadeData#9166); the async executor
page, the server guide and the example pages carry the pointer.

New test: a UNIQUE_HASH id end to end (SQL and openCypher lookup, update and delete
by id, EXPLAIN shows FETCH FROM INDEX, duplicate rejected). It passes on 26.9.1 and
26.10.1, so it has no version guard. The testing pages follow it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi
…y order, lookup_by_key is O(1) only for a hash index, hash NULL_STRATEGY ERROR is enforced from 26.10.1

Measured on 26.10.1 main (10 runs per arm on Temurin 21 and 25, 200,000 and 2,000,000 LONG ids, same answers): UNIQUE_HASH against UNIQUE answers SQL id = ? 1.5 to 2.3 times faster, an Index.get() hit 1.9 to 3.1 times, an UPDATE by id 1.04 to 1.13 times, a DELETE by id level, and inserts 1.14 to 1.23 times faster for shuffled ids but 9% to 16% slower for ascending ids. The known-issues sentence on hash indexes for identifiers now points at that rule. The hash null strategy note was checked on the 26.9.1 release (accepts null and missing keys) and on 3543960 (REBUILD INDEX over null rows fails and leaves the type without the index; deleting the rows first lets it rebuild).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi
@tae898
tae898 merged commit 09bf65d into main Oct 5, 2026
48 checks passed
@tae898
tae898 deleted the bindings-best-practices-oct5 branch October 7, 2026 14:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

1 participant