Skip to content

Denormalize trait membership (terms/traits sidecar) #301

@priethor

Description

@priethor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: performancePerformance budgets, profiling, benchmarks, and regressions.type: enhancementImprovement to existing behavior.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions