Membership runs through the crtxt_collection taxonomy, so every document query adds a tax_query JOIN over term_relationships and term_taxonomy, and resolving a document's trait hits the term tables. We accepted that in #280: the JOIN was ~1-3 ms, well inside the noise, and the boot win mattered more. But it scales with the workspace, so at some point it's worth taking off the hot paths.
Proposed solution: keep a denormalized copy of document→trait membership, like the field-value index, so the hot paths skip the JOIN. Prime the term lookups (term_id_for_trait, all_trait_ids, find_trait_for_document) once per request too.
Membership runs through the
crtxt_collectiontaxonomy, so every document query adds atax_queryJOIN overterm_relationshipsandterm_taxonomy, and resolving a document's trait hits the term tables. We accepted that in #280: the JOIN was ~1-3 ms, well inside the noise, and the boot win mattered more. But it scales with the workspace, so at some point it's worth taking off the hot paths.Proposed solution: keep a denormalized copy of document→trait membership, like the field-value index, so the hot paths skip the JOIN. Prime the term lookups (
term_id_for_trait,all_trait_ids,find_trait_for_document) once per request too.