LMDB key-size audit for a Datalevin store.
A string value longer than safe-value-length is stored and pullable but
cannot be bound by value in a :where clause, and cannot be looked up as a
:db.unique/identity. Datalevin reports no error — the query returns an
empty result, which is indistinguishable from absence.
Contract: (audit conn) => {attr {:max-len n :values n :unique u :over-limit? b}} (violations conn) => the sub-map whose :over-limit? is true (value-safe? s) => whether one value can be matched by value
LMDB key-size audit for a Datalevin store.
A string value longer than `safe-value-length` is stored and pullable but
cannot be bound by value in a `:where` clause, and cannot be looked up as a
`:db.unique/identity`. Datalevin reports no error — the query returns an
empty result, which is indistinguishable from absence.
Contract:
(audit conn) => {attr {:max-len n :values n :unique u :over-limit? b}}
(violations conn) => the sub-map whose :over-limit? is true
(value-safe? s) => whether one value can be matched by value(attribute-stats db attr)Longest value and value count for one attribute. Returns nil when the attribute has no datoms.
Longest value and value count for one attribute. Returns nil when the attribute has no datoms.
(audit conn)Key-size report for every string attribute in conn.
Each entry carries :max-len, :values, :unique (the :db/unique declaration, nil when not unique) and :over-limit? — true when the longest value cannot be matched by value.
Key-size report for every string attribute in `conn`. Each entry carries :max-len, :values, :unique (the :db/unique declaration, nil when not unique) and :over-limit? — true when the longest value cannot be matched by value.
LMDB's hard key limit in bytes, as compiled into Datalevin.
LMDB's hard key limit in bytes, as compiled into Datalevin.
(queryable-violations conn value-matched)Violations that are also REACHED by value: unique-identity attributes, plus
any attribute the caller names in value-matched. These are the ones that
silently return nothing; a violation on a payload-only attribute is inert.
Violations that are also REACHED by value: unique-identity attributes, plus any attribute the caller names in `value-matched`. These are the ones that silently return nothing; a violation on a payload-only attribute is inert.
Longest string that is still matchable by value. Measured 2026-08-20 on datalevin 0.10.18 by bisection: 497 matches, 498 does not. Independent of the attribute's name length — the key carries an integer attribute id.
Longest string that is still matchable by value. Measured 2026-08-20 on datalevin 0.10.18 by bisection: 497 matches, 498 does not. Independent of the attribute's name length — the key carries an integer attribute id.
(string-attributes conn)Attributes declared :db.type/string, as {attr schema-map}.
Attributes declared :db.type/string, as {attr schema-map}.
(value-safe? v)True when v is short enough to be bound by value in a :where clause.
True when `v` is short enough to be bound by value in a :where clause.
(violations conn)Attributes whose longest value exceeds safe-value-length.
Attributes whose longest value exceeds `safe-value-length`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |