Skip to main content

HYDRATE_CHUNK

Constant HYDRATE_CHUNK 

Source
pub const HYDRATE_CHUNK: usize = 400;
Expand description

How many ids go into one IN (…) list when hydrating attributes (T3.1).

Not a latency budget. These are reads, and crate::CHUNK_BUDGET bounds how long the writer holds the lock. This is a bind-variable ceiling: SQLITE_MAX_VARIABLE_NUMBER is 999 on a stock build, and hydrating a budget-sized subgraph in one statement would otherwise fail at the driver with an error that says nothing about node count.

400 leaves room for the other bound parameters a hydrate query carries (timestamps, mode discriminators) without arithmetic at every call site that would have to be re-checked whenever one of those queries gained a parameter.

§Why this lives in util (T3.1)

It was defined twice — in graph::subgraph and in temporal::as_of — both 400, with the reasoning written out at one of them and the other carrying // See as_of::HYDRATE_CHUNK. That is a working arrangement right up until someone tunes one of them, at which point two constants that must be equal silently are not, and the symptom is a driver error on one code path and not the other. The cross-reference comment is evidence the duplication was known and was being managed by convention; conventions are what a shared constant replaces.